From patchwork Fri Dec 20 16:06:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Simon Marchi (Code Review)" X-Patchwork-Id: 36976 Received: (qmail 40899 invoked by alias); 20 Dec 2019 16:06:11 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 40875 invoked by uid 89); 20 Dec 2019 16:06:11 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=H*R:U*noreply, xfree, screen X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 20 Dec 2019 16:06:10 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id 67B282032B; Fri, 20 Dec 2019 11:06:08 -0500 (EST) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [8.43.85.239]) by mx1.osci.io (Postfix) with ESMTP id 2BF05201AD; Fri, 20 Dec 2019 11:06:07 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id 04AA32816F; Fri, 20 Dec 2019 11:06:06 -0500 (EST) X-Gerrit-PatchSet: 2 Date: Fri, 20 Dec 2019 11:06:06 -0500 From: "Sourceware to Gerrit sync (Code Review)" To: Tom Tromey , gdb-patches@sourceware.org Auto-Submitted: auto-generated X-Gerrit-MessageType: newpatchset Subject: [pushed] Make isearch change readline prompt in TUI X-Gerrit-Change-Id: Iae97e9776a5540bbe52c73b05e4707941d9cd11a X-Gerrit-Change-Number: 694 X-Gerrit-ChangeURL: X-Gerrit-Commit: 364d710448e607e4ae9cb338583179dd6e734f0b In-Reply-To: References: Reply-To: noreply@gnutoolchain-gerrit.osci.io, tromey@sourceware.org, gdb-patches@sourceware.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/3.0.3-79-g83ff7f88f1 Message-Id: <20191220160607.04AA32816F@gnutoolchain-gerrit.osci.io> 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 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 + + 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 * 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