diff options
Diffstat (limited to 'gdb/cli')
-rw-r--r-- | gdb/cli/cli-cmds.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index fb41e24..af750d3 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -266,6 +266,7 @@ complete_command (char *arg_entry, int from_tty) completion_tracker tracker_handle_brkchars; completion_tracker tracker_handle_completions; + completion_tracker *tracker; int quote_char = '\0'; const char *word; @@ -275,8 +276,17 @@ complete_command (char *arg_entry, int from_tty) word = completion_find_completion_word (tracker_handle_brkchars, arg, "e_char); - /* Completers must be called twice. */ - complete_line (tracker_handle_completions, word, arg, strlen (arg)); + /* Completers that provide a custom word point in the + handle_brkchars phase also compute their completions then. + Completers that leave the completion word handling to readline + must be called twice. */ + if (tracker_handle_brkchars.use_custom_word_point ()) + tracker = &tracker_handle_brkchars; + else + { + complete_line (tracker_handle_completions, word, arg, strlen (arg)); + tracker = &tracker_handle_completions; + } } CATCH (ex, RETURN_MASK_ALL) { @@ -286,8 +296,7 @@ complete_command (char *arg_entry, int from_tty) std::string arg_prefix (arg, word - arg); completion_result result - = (tracker_handle_completions.build_completion_result - (word, word - arg, strlen (arg))); + = tracker->build_completion_result (word, word - arg, strlen (arg)); if (result.number_matches != 0) { |