[PATCH] Add completion styling
Eli Zaretskii
eliz@gnu.org
Thu Apr 9 06:39:41 GMT 2020
> From: Tom Tromey <tom@tromey.com>
> Date: Wed, 8 Apr 2020 20:41:12 -0600
> Cc: Tom Tromey <tom@tromey.com>
>
> Readline has a styling feature for completion -- if it is enabled, the
> common prefix of completions will be displayed in a different style.
> This doesn't work in gdb, because gdb implements its own completer.
>
> This patch implements the feature. However, it doesn't directly use
> the Readline feature, because gdb can do a bit better: it can let the
> user control the styling using the existing mechanisms.
Would it make sense to default to the style determined by the user's
colored-completion-prefix setting?
Also, do we want the default styling to be no-styling, or do we want
something else?
> gdb/ChangeLog
> 2020-04-08 Tom Tromey <tom@tromey.com>
>
> * NEWS: Add entry for completion styling.
> * completer.c (_rl_completion_prefix_display_length): Move
> declaration earlier.
> (gdb_fnprint): Use completion_style.
> (gdb_display_match_list_1): Likewise.
> * cli/cli-style.c (completion_style): New global.
> (_initialize_cli_style): Register new global.
> * cli/cli-style.h (completion_style): Declare.
>
> gdb/doc/ChangeLog
> 2020-04-08 Tom Tromey <tom@tromey.com>
>
> * gdb.texinfo (Output Styling): Mention "completion" styling.
> (Editing): Mention readline completion styling.
The documentation parts are okay, but maybe we should say something
about the default styling of this, even if the default is no styling.
Btw, Emacs solves this problem differently: it uses a distinct styling
for the first character that distinguishes between completion
candidates. I wonder if that idea is more useful for quickly
realizing what one needs to type next. Or do we want to follow
Readline here for consistency reasons?
Thanks.
More information about the Gdb-patches
mailing list