All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alain Michaud <alainm@chromium.org>
To: linux-bluetooth@vger.kernel.org, luiz.dentz@gmail.com
Cc: Alain Michaud <alainm@chromium.org>
Subject: [Bluez PATCH] shared/shell: don't allow completion fallback
Date: Fri,  3 Sep 2021 14:01:18 +0000	[thread overview]
Message-ID: <20210903140118.3469656-1-alainm@chromium.org> (raw)

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


             reply	other threads:[~2021-09-03 14:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-03 14:01 Alain Michaud [this message]
2021-09-03 14:33 ` [Bluez] shared/shell: don't allow completion fallback bluez.test.bot
2021-09-04  0:33   ` Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210903140118.3469656-1-alainm@chromium.org \
    --to=alainm@chromium.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.