Make isearch change readline prompt in TUI
authorTom Tromey <tom@tromey.com>
Wed, 20 Nov 2019 23:39:44 +0000 (16:39 -0700)
committerTom Tromey <tom@tromey.com>
Fri, 20 Dec 2019 15:49:52 +0000 (08:49 -0700)
PR tui/23619 points out that isearch changes the prompt in the CLI gdb
(and in Bash) -- but not in the TUI.  This turns out to be easily
fixed by removing tui_rl_saved_prompt and instead using the prompt
that readline computes.

This is stored in rl_display_prompt, which according to git was added
in readline 6.2.

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

PR tui/23619:
* tui/tui-io.c (tui_rl_saved_prompt): Remove.
(tui_redisplay_readline): Use rl_display_prompt.
(tui_prep_terminal): Update.

Change-Id: Iae97e9776a5540bbe52c73b05e4707941d9cd11a

gdb/ChangeLog
gdb/tui/tui-io.c

index f7c84c01c9a513a244382e9910ce801e6a1c730d..1b838b91894578a3a1011352f62aa2b6d97e41d6 100644 (file)
@@ -1,3 +1,10 @@
+2019-12-20  Tom Tromey  <tom@tromey.com>
+
+       PR tui/23619:
+       * tui/tui-io.c (tui_rl_saved_prompt): Remove.
+       (tui_redisplay_readline): Use rl_display_prompt.
+       (tui_prep_terminal): Update.
+
 2019-12-19  Christian Biesinger  <cbiesinger@google.com>
 
        * configure: Regenerate.
index 2eef288bdbce8d4f598f1d3397b4c7bb5732ab06..d902d9e920180f266539bd038eee5751eb6f696f 100644 (file)
@@ -131,10 +131,6 @@ static FILE *tui_old_rl_outstream;
 static int tui_readline_pipe[2];
 #endif
 
-/* The last gdb prompt that was registered in readline.
-   This may be the main gdb prompt or a secondary prompt.  */
-static char *tui_rl_saved_prompt;
-
 /* Print a character in the curses command window.  The output is
    buffered.  It is up to the caller to refresh the screen if
    necessary.  */
@@ -538,7 +534,7 @@ tui_redisplay_readline (void)
   if (tui_current_key_mode == TUI_SINGLE_KEY_MODE)
     prompt = "";
   else
-    prompt = tui_rl_saved_prompt;
+    prompt = rl_display_prompt;
   
   c_pos = -1;
   c_line = -1;
@@ -606,11 +602,6 @@ tui_redisplay_readline (void)
 static void
 tui_prep_terminal (int notused1)
 {
-  /* Save the prompt registered in readline to correctly display it.
-     (we can't use gdb_prompt() due to secondary prompts and can't use
-     rl_prompt because it points to an alloca buffer).  */
-  xfree (tui_rl_saved_prompt);
-  tui_rl_saved_prompt = rl_prompt != NULL ? xstrdup (rl_prompt) : NULL;
 }
 
 /* Readline callback to restore the terminal.  It is called once each
This page took 0.03215 seconds and 4 git commands to generate.