summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2019-05-30 20:40:11 +0100
committerPedro Alves <palves@redhat.com>2019-06-04 22:52:41 +0100
commit0918ebba4bacc0f7d7795b932331a126d15acb72 (patch)
tree0aaa4176800639fc752ab5f451c5e447251793a3
parentb02f78f9285728ce2d05ce01e7b14880f70cd6e6 (diff)
downloadbinutils-gdb-0918ebba4bacc0f7d7795b932331a126d15acb72.tar.gz
Fix latent bug in custom word point completion handling
Without this fix, if we switch the "print" completer to custom word point handling, we regress gdb.base/completion.exp like this: (gdb) p "break1.c FAIL: gdb.base/completion.exp: complete 'p "break1' (timeout) The problem is that completing an expression that starts with double quotes, and resolves to a filename, like this: (gdb) p "break1[TAB] would change from this, with current master: (gdb) p "break1.c"| ^^^^^^^^^^| \- cursor here to this: (gdb) p "break1.c | ^^^^^^^^^^| \- quote replaced by space The issue is that completer.c:advance_to_completion_word misses telling the completion tracker to emulate readline's handling of completing a string when rl_find_completion_word returns a delimiter. This commit fixes the latent bug. gdb/ChangeLog: yyyy-mm-dd Pedro Alves <palves@redhat.com> * completer.c (advance_to_completion_word): Handle delimiters.
-rw-r--r--gdb/completer.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gdb/completer.c b/gdb/completer.c
index d4773f2a77b..03d0d0e5dbd 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -365,11 +365,18 @@ advance_to_expression_complete_word_point (completion_tracker &tracker,
info.quote_characters = gdb_completer_quote_characters;
info.basic_quote_characters = rl_basic_quote_characters;
+ int delimiter;
const char *start
- = gdb_rl_find_completion_word (&info, NULL, NULL, text);
+ = gdb_rl_find_completion_word (&info, NULL, &delimiter, text);
tracker.advance_custom_word_point_by (start - text);
+ if (delimiter)
+ {
+ tracker.set_quote_char (delimiter);
+ tracker.set_suppress_append_ws (true);
+ }
+
return start;
}