public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [review] Make isearch change readline prompt in TUI
@ 2019-11-20 23:41 Tom Tromey (Code Review)
  2019-12-20 15:54 ` Tom Tromey (Code Review)
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tom Tromey (Code Review) @ 2019-11-20 23:41 UTC (permalink / raw)
  To: gdb-patches

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/694
......................................................................

Make isearch change readline prompt in TUI

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.

2019-11-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
---
M gdb/ChangeLog
M gdb/tui/tui-io.c
2 files changed, 8 insertions(+), 10 deletions(-)



diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index cf65de2..165449e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2019-11-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-11-19  Tom Tromey  <tom@tromey.com>
 
 	* tui/tui-win.c (tui_partial_win_by_name): Move from tui-data.c.
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index 964f2e3..164cd5d 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -131,10 +131,6 @@
 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 @@
   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 @@
 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

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Iae97e9776a5540bbe52c73b05e4707941d9cd11a
Gerrit-Change-Number: 694
Gerrit-PatchSet: 1
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newchange

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [review] Make isearch change readline prompt in TUI
  2019-11-20 23:41 [review] Make isearch change readline prompt in TUI Tom Tromey (Code Review)
@ 2019-12-20 15:54 ` Tom Tromey (Code Review)
  2019-12-20 16:06 ` [pushed] " Sourceware to Gerrit sync (Code Review)
  2019-12-20 16:06 ` Sourceware to Gerrit sync (Code Review)
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey (Code Review) @ 2019-12-20 15:54 UTC (permalink / raw)
  To: gdb-patches

Tom Tromey has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/694
......................................................................


Patch Set 1:

I'm going to check this in shortly.


-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Iae97e9776a5540bbe52c73b05e4707941d9cd11a
Gerrit-Change-Number: 694
Gerrit-PatchSet: 1
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Fri, 20 Dec 2019 15:54:42 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pushed] Make isearch change readline prompt in TUI
  2019-11-20 23:41 [review] Make isearch change readline prompt in TUI Tom Tromey (Code Review)
  2019-12-20 15:54 ` Tom Tromey (Code Review)
@ 2019-12-20 16:06 ` Sourceware to Gerrit sync (Code Review)
  2019-12-20 16:06 ` Sourceware to Gerrit sync (Code Review)
  2 siblings, 0 replies; 4+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-12-20 16:06 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

Sourceware to Gerrit sync has submitted this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/694
......................................................................

Make isearch change readline prompt in TUI

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
---
M gdb/ChangeLog
M gdb/tui/tui-io.c
2 files changed, 8 insertions(+), 10 deletions(-)


diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f7c84c0..1b838b9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index 2eef288..d902d9e 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -131,10 +131,6 @@
 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 @@
   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 @@
 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

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Iae97e9776a5540bbe52c73b05e4707941d9cd11a
Gerrit-Change-Number: 694
Gerrit-PatchSet: 2
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: merged

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pushed] Make isearch change readline prompt in TUI
  2019-11-20 23:41 [review] Make isearch change readline prompt in TUI Tom Tromey (Code Review)
  2019-12-20 15:54 ` Tom Tromey (Code Review)
  2019-12-20 16:06 ` [pushed] " Sourceware to Gerrit sync (Code Review)
@ 2019-12-20 16:06 ` Sourceware to Gerrit sync (Code Review)
  2 siblings, 0 replies; 4+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-12-20 16:06 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

The original change was created by Tom Tromey.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/694
......................................................................

Make isearch change readline prompt in TUI

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
---
M gdb/ChangeLog
M gdb/tui/tui-io.c
2 files changed, 8 insertions(+), 10 deletions(-)



diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f7c84c0..1b838b9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index 2eef288..d902d9e 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -131,10 +131,6 @@
 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 @@
   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 @@
 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

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Iae97e9776a5540bbe52c73b05e4707941d9cd11a
Gerrit-Change-Number: 694
Gerrit-PatchSet: 2
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newpatchset

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-12-20 16:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-20 23:41 [review] Make isearch change readline prompt in TUI Tom Tromey (Code Review)
2019-12-20 15:54 ` Tom Tromey (Code Review)
2019-12-20 16:06 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-12-20 16:06 ` Sourceware to Gerrit sync (Code Review)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).