summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-05-24 20:25:09 -0600
committerTom Tromey <tom@tromey.com>2020-05-24 20:27:48 -0600
commit0a4f5f8cae7ced715aca791bf4b212f43165119c (patch)
tree93b70ac665a17a33c0d732e7746f62b3e6f1c9b3
parentddb9ebd500c5accf0128b703a8154ef710bf604c (diff)
downloadbinutils-gdb-0a4f5f8cae7ced715aca791bf4b212f43165119c.tar.gz
Revert "Add completion styling"
This reverts commit eca1f90cf47a2edc1a1cd22e12c6c0f3b900654e. Several changes were requested, and it seemed simplest to revert it. gdb/ChangeLog 2020-05-23 Tom Tromey <tom@tromey.com> Revert commit eca1f90c: * NEWS: Remove entry for completion styling. * completer.c (_rl_completion_prefix_display_length): Move declaration later. (gdb_fnprint): Revert. (gdb_display_match_list_1): Likewise. * cli/cli-style.c (completion_prefix_style) (completion_difference_style, completion_suffix_style): Remove. (_initialize_cli_style): Revert. * cli/cli-style.h (completion_prefix_style) (completion_difference_style, completion_suffix_style): Don't declare. gdb/doc/ChangeLog 2020-05-23 Tom Tromey <tom@tromey.com> * gdb.texinfo (Output Styling): Don't mention completion styling. (Editing): Don't mention readline completion styling. gdb/testsuite/ChangeLog 2020-05-23 Tom Tromey <tom@tromey.com> * gdb.base/style.exp: Remove completion styling test. * lib/gdb-utils.exp (style): Remove completion styles.
-rw-r--r--gdb/ChangeLog15
-rw-r--r--gdb/NEWS11
-rw-r--r--gdb/cli/cli-style.c42
-rw-r--r--gdb/cli/cli-style.h9
-rw-r--r--gdb/completer.c57
-rw-r--r--gdb/doc/ChangeLog5
-rw-r--r--gdb/doc/gdb.texinfo20
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.base/style.exp14
-rw-r--r--gdb/testsuite/lib/gdb-utils.exp2
10 files changed, 32 insertions, 148 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9f65e2df970..79995c93be0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,18 @@
+2020-05-23 Tom Tromey <tom@tromey.com>
+
+ Revert commit eca1f90c:
+ * NEWS: Remove entry for completion styling.
+ * completer.c (_rl_completion_prefix_display_length): Move
+ declaration later.
+ (gdb_fnprint): Revert.
+ (gdb_display_match_list_1): Likewise.
+ * cli/cli-style.c (completion_prefix_style)
+ (completion_difference_style, completion_suffix_style): Remove.
+ (_initialize_cli_style): Revert.
+ * cli/cli-style.h (completion_prefix_style)
+ (completion_difference_style, completion_suffix_style): Don't
+ declare.
+
2020-05-24 Pedro Alves <palves@redhat.com>
* symtab.c (completion_list_add_name): Return boolean indication
diff --git a/gdb/NEWS b/gdb/NEWS
index 23a4ed7294e..2a9c8b8ee19 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -62,17 +62,6 @@ show exec-file-mismatch -- Show exec-file-mismatch handling (ask|warn|off).
executable file; if 'warn', just display a warning; if 'off', don't
attempt to detect a mismatch.
-set style completion-prefix foreground COLOR
-set style completion-prefix background COLOR
-set style completion-prefix intensity VALUE
-set style completion-difference foreground COLOR
-set style completion-difference background COLOR
-set style completion-difference intensity VALUE
-set style completion-suffix foreground COLOR
-set style completion-suffix background COLOR
-set style completion-suffix intensity VALUE
- Control the styling of completions.
-
tui new-layout NAME WINDOW WEIGHT [WINDOW WEIGHT]...
Define a new TUI layout, specifying its name and the windows that
will be displayed.
diff --git a/gdb/cli/cli-style.c b/gdb/cli/cli-style.c
index b16b800d152..a0c3cc51801 100644
--- a/gdb/cli/cli-style.c
+++ b/gdb/cli/cli-style.c
@@ -98,21 +98,6 @@ cli_style_option metadata_style ("metadata", ui_file_style::DIM);
/* See cli-style.h. */
-cli_style_option completion_prefix_style ("completion-prefix",
- ui_file_style::DIM);
-
-/* See cli-style.h. */
-
-cli_style_option completion_difference_style ("completion-difference",
- ui_file_style::MAGENTA);
-
-/* See cli-style.h. */
-
-cli_style_option completion_suffix_style ("completion-suffix",
- ui_file_style::NONE);
-
-/* See cli-style.h. */
-
cli_style_option::cli_style_option (const char *name,
ui_file_style::basic_color fg)
: changed (name),
@@ -381,33 +366,6 @@ your data, for example \"<unavailable>\""),
&style_set_list, &style_show_list,
false);
- completion_prefix_style.add_setshow_commands (no_class, _("\
-Completion prefix display styling.\n\
-Configure completion prefix colors and display intensity\n\
-The \"completion-prefix\" style is used when GDB displays the shared\n\
-prefix common to the possible completions."),
- &style_set_list,
- &style_show_list,
- false);
-
- completion_difference_style.add_setshow_commands (no_class, _("\
-Completion difference display styling.\n\
-Configure completion difference colors and display intensity\n\
-The \"completion-difference\" style is used when GDB displays the\n\
-character that differs between the possible completions."),
- &style_set_list,
- &style_show_list,
- false);
-
- completion_suffix_style.add_setshow_commands (no_class, _("\
-Completion suffix display styling.\n\
-Configure completion suffix colors and display intensity\n\
-The \"completion-suffix\" style is used when GDB displays the suffix\n\
-of the possible completions."),
- &style_set_list,
- &style_show_list,
- false);
-
tui_border_style.add_setshow_commands (no_class, _("\
TUI border display styling.\n\
Configure TUI border colors\n\
diff --git a/gdb/cli/cli-style.h b/gdb/cli/cli-style.h
index c2e0df1b337..6422e5296a3 100644
--- a/gdb/cli/cli-style.h
+++ b/gdb/cli/cli-style.h
@@ -124,15 +124,6 @@ extern cli_style_option tui_border_style;
/* The border style of a TUI window that does have the focus. */
extern cli_style_option tui_active_border_style;
-/* The style for the common prefix of completions. */
-extern cli_style_option completion_prefix_style;
-
-/* The style for the difference character of completions. */
-extern cli_style_option completion_difference_style;
-
-/* The style for the suffix of completions. */
-extern cli_style_option completion_suffix_style;
-
/* True if source styling is enabled. */
extern bool source_styling;
diff --git a/gdb/completer.c b/gdb/completer.c
index bc0501abf0a..ad33b98c696 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -31,7 +31,6 @@
#include <algorithm>
#include "linespec.h"
#include "cli/cli-decode.h"
-#include "cli/cli-style.h"
/* FIXME: This is needed because of lookup_cmd_1 (). We should be
calling a hook instead so we eliminate the CLI dependency. */
@@ -2715,8 +2714,6 @@ gdb_fnwidth (const char *string)
return width;
}
-extern int _rl_completion_prefix_display_length;
-
/* Print TO_PRINT, one matching completion.
PREFIX_BYTES is number of common prefix bytes.
Based on readline/complete.c:fnprint. */
@@ -2725,7 +2722,7 @@ static int
gdb_fnprint (const char *to_print, int prefix_bytes,
const struct match_list_displayer *displayer)
{
- int common_prefix_len, printed_len, w;
+ int printed_len, w;
const char *s;
#if defined (HANDLE_MULTIBYTE)
mbstate_t ps;
@@ -2738,18 +2735,14 @@ gdb_fnprint (const char *to_print, int prefix_bytes,
memset (&ps, 0, sizeof (mbstate_t));
#endif
- printed_len = common_prefix_len = 0;
+ printed_len = 0;
/* Don't print only the ellipsis if the common prefix is one of the
possible completions */
if (to_print[prefix_bytes] == '\0')
prefix_bytes = 0;
- ui_file_style style = completion_prefix_style.style ();
- if (!style.is_default ())
- displayer->puts (displayer, style.to_ansi ().c_str ());
-
- if (prefix_bytes && _rl_completion_prefix_display_length > 0)
+ if (prefix_bytes)
{
char ellipsis;
@@ -2758,16 +2751,6 @@ gdb_fnprint (const char *to_print, int prefix_bytes,
displayer->putch (displayer, ellipsis);
printed_len = ELLIPSIS_LEN;
}
- else if (prefix_bytes && !style.is_default ())
- {
- common_prefix_len = prefix_bytes;
- prefix_bytes = 0;
- }
-
- /* There are 3 states: the initial state (#0), when we use the
- prefix style; the difference state (#1), which lasts a single
- character; and then the suffix state (#2). */
- int state = 0;
s = to_print + prefix_bytes;
while (*s)
@@ -2819,31 +2802,8 @@ gdb_fnprint (const char *to_print, int prefix_bytes,
printed_len++;
#endif
}
- if (common_prefix_len > 0 && (s - to_print) >= common_prefix_len)
- {
- if (!style.is_default ())
- displayer->puts (displayer, ui_file_style ().to_ansi ().c_str ());
-
- ++state;
- if (state == 1)
- {
- common_prefix_len = 1;
- style = completion_difference_style.style ();
- }
- else
- {
- common_prefix_len = 0;
- style = completion_suffix_style.style ();
- }
-
- if (!style.is_default ())
- displayer->puts (displayer, style.to_ansi ().c_str ());
- }
}
- if (!style.is_default ())
- displayer->puts (displayer, ui_file_style ().to_ansi ().c_str ());
-
return printed_len;
}
@@ -2952,6 +2912,7 @@ gdb_complete_get_screenwidth (const struct match_list_displayer *displayer)
return displayer->width;
}
+extern int _rl_completion_prefix_display_length;
extern int _rl_print_completions_horizontally;
EXTERN_C int _rl_qsort_string_compare (const void *, const void *);
@@ -2970,23 +2931,19 @@ gdb_display_match_list_1 (char **matches, int len, int max,
char *temp, *t;
int page_completions = displayer->height != INT_MAX && pagination_enabled;
- bool want_style = !completion_prefix_style.style ().is_default ();
-
/* Find the length of the prefix common to all items: length as displayed
characters (common_length) and as a byte index into the matches (sind) */
common_length = sind = 0;
- if (_rl_completion_prefix_display_length > 0 || want_style)
+ if (_rl_completion_prefix_display_length > 0)
{
t = gdb_printable_part (matches[0]);
temp = strrchr (t, '/');
common_length = temp ? gdb_fnwidth (temp) : gdb_fnwidth (t);
sind = temp ? strlen (temp) : strlen (t);
- if (_rl_completion_prefix_display_length > 0
- && common_length > _rl_completion_prefix_display_length
- && common_length > ELLIPSIS_LEN)
+ if (common_length > _rl_completion_prefix_display_length && common_length > ELLIPSIS_LEN)
max -= common_length - ELLIPSIS_LEN;
- else if (!want_style || common_length > max || sind > max)
+ else
common_length = sind = 0;
}
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 8a86047b45d..5a39643871c 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,5 +1,10 @@
2020-05-23 Tom Tromey <tom@tromey.com>
+ * gdb.texinfo (Output Styling): Don't mention completion styling.
+ (Editing): Don't mention readline completion styling.
+
+2020-05-23 Tom Tromey <tom@tromey.com>
+
* gdb.texinfo (Output Styling): Mention completion styling.
(Editing): Mention readline completion styling.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 10d4173a723..64181628495 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -25271,10 +25271,6 @@ This command accepts the current line for execution and fetches the
next line relative to the current line from the history for editing.
Any argument is ignored.
-Note that @value{GDBN} ignores the Readline
-@code{colored-completion-prefix} setting. Instead, this is handled
-using the style settings (@xref{Output Styling}).
-
@node Command History
@section Command History
@cindex command history
@@ -25608,22 +25604,6 @@ general styling to @value{GDBN}. @xref{TUI Configuration}.
Control the styling of the active TUI border; that is, the TUI window
that has the focus.
-@item completion-prefix
-Control the styling of the completion prefix. When completing, the
-common prefix of completion candidates will be shown with this style.
-By default, this style's intensity is dim.
-
-@item completion-difference
-Control the styling of the completion difference character. When
-completing, the character that differs between different completions
-will be shown using this style. By default, this style's foreground
-color is magenta.
-
-@item completion-suffix
-Control the styling of the completion suffix. When completing, the
-suffix of completion candidates will be shown with this style. By
-default, this style is the same as the default styling.
-
@end table
@node Numbers
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 33fad924870..f189ba3ab7b 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2020-05-23 Tom Tromey <tom@tromey.com>
+ * gdb.base/style.exp: Remove completion styling test.
+ * lib/gdb-utils.exp (style): Remove completion styles.
+
+2020-05-23 Tom Tromey <tom@tromey.com>
+
* gdb.base/style.exp: Add completion styling test.
* lib/gdb-utils.exp (style): Add completion styles.
diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp
index 23a35403bbf..129f1746a39 100644
--- a/gdb/testsuite/gdb.base/style.exp
+++ b/gdb/testsuite/gdb.base/style.exp
@@ -167,18 +167,4 @@ save_vars { env(TERM) } {
"warning: [style .*? file] is not a directory\\..*"
gdb_test "show data-directory" \
"GDB's data directory is \"[style .*? file]\"\\..*"
-
- if {[readline_is_used]} {
- set test "complete print VALUE_"
- # ESC-? is the readline binding to show all completions.
- send_gdb "print VALUE_\x1b?"
- set pfx [style VALUE_ completion-prefix]
- set d1 [style O completion-difference]
- set d2 [style T completion-difference]
- gdb_test_multiple "" $test {
- -re "${pfx}${d1}NE\[ \t\]+${pfx}${d2}WO.*$gdb_prompt print VALUE_$" {
- gdb_test "ONE" " = .*"
- }
- }
- }
}
diff --git a/gdb/testsuite/lib/gdb-utils.exp b/gdb/testsuite/lib/gdb-utils.exp
index 98bdd7206a4..9741f0a9591 100644
--- a/gdb/testsuite/lib/gdb-utils.exp
+++ b/gdb/testsuite/lib/gdb-utils.exp
@@ -55,8 +55,6 @@ proc style {str style} {
variable { set style 36 }
address { set style 34 }
metadata { set style 2 }
- completion-prefix { set style 2 }
- completion-difference { set style 35 }
}
return "\033\\\[${style}m${str}\033\\\[m"
}