Message ID | 1409422278-19284-1-git-send-email-patrick@parcs.ath.cx |
---|---|
State | New, archived |
Headers |
Received: (qmail 24032 invoked by alias); 30 Aug 2014 18:11:36 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 24018 invoked by uid 89); 30 Aug 2014 18:11:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-HELO: mail-qa0-f46.google.com Received: from mail-qa0-f46.google.com (HELO mail-qa0-f46.google.com) (209.85.216.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 30 Aug 2014 18:11:34 +0000 Received: by mail-qa0-f46.google.com with SMTP id w8so3439179qac.33 for <gdb-patches@sourceware.org>; Sat, 30 Aug 2014 11:11:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=MN12LTRHCZjCBceXUTpLtZf7Xt4l9XfTNrLOJltpeRU=; b=ifRHoZzDZfVHV8nHZtpe56kYLgXR+SYbJWxYsunxRmvD+RBu5j150Ogeh6dFoKXywL oPZKvPrNg86vTNt2qlYk0I1QQw1O0XvzLcdl+hJJxLGnmjrK71+rzpGY3Xk8nKoUkGqD dg4/lM16xRUm6xtGXbUuN6z6mK73oBjYi3CmBWbyXQ6+pAZXK6MwLz+dfM6KsbLrW4Nh j8893eIQcDWxBUI3C3Upgo4khe/fDL8Lt/CRv3NyxUh/It4lOfvEOB73K7YmmQaJV1nR NvcpojTMci4oQy5R09LQFP830Nn6DArLUaiUz/E6IyhQFd9LPJklZruRhWJnzZC11sfL FTyg== X-Gm-Message-State: ALoCoQnQWEwEF0Fekl502GpKOywcWWQdu2BMqZJWEjgHc9kN9pAtz3HT5eWuKqDMMVLvdcRwxNQu X-Received: by 10.224.51.197 with SMTP id e5mr29291996qag.48.1409422291927; Sat, 30 Aug 2014 11:11:31 -0700 (PDT) Received: from localhost.localdomain (ool-4353af5c.dyn.optonline.net. [67.83.175.92]) by mx.google.com with ESMTPSA id p5sm10817234qah.3.2014.08.30.11.11.30 for <multiple recipients> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 30 Aug 2014 11:11:31 -0700 (PDT) From: Patrick Palka <patrick@parcs.ath.cx> To: gdb-patches@sourceware.org Cc: Patrick Palka <patrick@parcs.ath.cx> Subject: [PATCH] Fix truncation of TUI command history Date: Sat, 30 Aug 2014 14:11:18 -0400 Message-Id: <1409422278-19284-1-git-send-email-patrick@parcs.ath.cx> X-IsSubscribed: yes |
Commit Message
Patrick Palka
Aug. 30, 2014, 6:11 p.m. UTC
If we submit a command while the prompt cursor is somewhere other than at the end of the command line, the command line gets truncated as the command window gets shifted one line up. This happens because we fail to properly move the cursor to the end of the command line before transmitting the newline to ncurses. We need to move the cursor because when ncurses outputs a newline it truncates any text that appears past the end of the cursor. * tui/tui-io.c (tui_getc): Move cursor to the end of the command line before printing a newline. --- gdb/tui/tui-io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Comments
Hi Patrick, On 08/30/2014 07:11 PM, Patrick Palka wrote: > index aa14790..eee5f1ac6 100644 > --- a/gdb/tui/tui-io.c > +++ b/gdb/tui/tui-io.c > @@ -678,8 +678,9 @@ tui_getc (FILE *fp) > } > else > { > + /* Move cursor to the end of the command line. */ > wmove (w, TUI_CMD_WIN->detail.command_info.cur_line, > - TUI_CMD_WIN->detail.command_info.curch); > + strlen (tui_rl_saved_prompt) + rl_end); > waddch (w, ch); Does this still do the right thing with secondary prompts? E.g., if you do "quit" while a program is running, and then press enter a few times just to have the query repeat (and then pagination kick in, for extra stress). Thanks, Pedro Alves
On Thu, Sep 4, 2014 at 5:44 AM, Pedro Alves <palves@redhat.com> wrote: > Hi Patrick, > > On 08/30/2014 07:11 PM, Patrick Palka wrote: >> index aa14790..eee5f1ac6 100644 >> --- a/gdb/tui/tui-io.c >> +++ b/gdb/tui/tui-io.c >> @@ -678,8 +678,9 @@ tui_getc (FILE *fp) >> } >> else >> { >> + /* Move cursor to the end of the command line. */ >> wmove (w, TUI_CMD_WIN->detail.command_info.cur_line, >> - TUI_CMD_WIN->detail.command_info.curch); >> + strlen (tui_rl_saved_prompt) + rl_end); >> waddch (w, ch); > > Does this still do the right thing with secondary prompts? > > E.g., if you do "quit" while a program is running, and then > press enter a few times just to have the query repeat (and > then pagination kick in, for extra stress). > > Thanks, > Pedro Alves > Good point. It doesn't work correctly in this case. I'll try to find a better solution.
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c index aa14790..eee5f1ac6 100644 --- a/gdb/tui/tui-io.c +++ b/gdb/tui/tui-io.c @@ -678,8 +678,9 @@ tui_getc (FILE *fp) } else { + /* Move cursor to the end of the command line. */ wmove (w, TUI_CMD_WIN->detail.command_info.cur_line, - TUI_CMD_WIN->detail.command_info.curch); + strlen (tui_rl_saved_prompt) + rl_end); waddch (w, ch); } }