2021-09-03 14:06:34

by Alain Michaud

[permalink] [raw]
Subject: [Bluez PATCH] shared/shell: don't allow completion fallback

When using bluetoothctl, if the user enters a quotation mark before
pressing tab, the completion handler falls back to the shell's handler
which ends up printing the current folder's file content. This behavior
is never desired in bt_shell's menu.

This was verified by typing " then tab-tab before and after the change as
been made to confirm the desired behavior and verified that all other
argument completions (such as address completion) continues to function.

---

src/shared/shell.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/shared/shell.c b/src/shared/shell.c
index 21e8b50cd..cbb9b8b88 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -903,6 +903,8 @@ static char **shell_completion(const char *text, int start, int end)
{
char **matches = NULL;

+ rl_attempted_completion_over = 1;
+
if (!data.menu)
return NULL;

@@ -925,9 +927,6 @@ static char **shell_completion(const char *text, int start, int end)
matches = rl_completion_matches(text, cmd_generator);
}

- if (!matches)
- rl_attempted_completion_over = 1;
-
return matches;
}

--
2.33.0.153.gba50c8fa24-goog