From patchwork Sun Mar 17 15:56:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Zaretskii X-Patchwork-Id: 31874 Received: (qmail 35095 invoked by alias); 17 Mar 2019 15:56:58 -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 35086 invoked by uid 89); 17 Mar 2019 15:56:57 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=WDYT, wdyt, appended, WINDOW X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (209.51.188.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 17 Mar 2019 15:56:56 +0000 Received: from fencepost.gnu.org ([2001:470:142:3::e]:47073) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h5Y9d-0007PB-Oj; Sun, 17 Mar 2019 11:56:53 -0400 Received: from [176.228.60.248] (port=2876 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1h5Y9c-0001KD-QM; Sun, 17 Mar 2019 11:56:53 -0400 Date: Sun, 17 Mar 2019 17:56:41 +0200 Message-Id: <83wokxwl3a.fsf@gnu.org> From: Eli Zaretskii To: Tom Tromey CC: palves@redhat.com, brobecker@adacore.com, gdb-patches@sourceware.org In-reply-to: <878sxhfjk7.fsf@tromey.com> (message from Tom Tromey on Thu, 14 Mar 2019 11:32:40 -0600) Subject: Re: GDB 8.2.90 available for testing References: <20190227055112.4A5E782D7B@joel.gnat.com> <835zt3kbjf.fsf@gnu.org> <87k1hae23l.fsf@tromey.com> <835zstbyhb.fsf@gnu.org> <87zhq5f5j3.fsf@tromey.com> <83sgvw8tjv.fsf@gnu.org> <878sxhfjk7.fsf@tromey.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-IsSubscribed: yes > From: Tom Tromey > Cc: Tom Tromey , palves@redhat.com, brobecker@adacore.com, gdb-patches@sourceware.org > Date: Thu, 14 Mar 2019 11:32:40 -0600 > > The appended patch seems to work ok for me, at the cost of leaving the > gdb prompt in the TUI console window. > > Tom > > diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c > index ef1e88507aa..f3eb2273e6b 100644 > --- a/gdb/tui/tui-io.c > +++ b/gdb/tui/tui-io.c > @@ -631,7 +631,7 @@ gdb_wgetch (WINDOW *win) > after the command. So, if we read \r, emit a \r now, after nl > mode has been re-entered, so that the output looks correct. */ > if (r == '\r') > - puts ("\r"); > + waddch (win, '\n'); > return r; > } Works for me, and I think that "cost" is a small one to pay. However, your change gave me an idea, and I think I came up with a bit better fix, see below (the patch is again the current HEAD). With that, the original problem seems to be fixed, and we still don't produce redundant lines in the command window. WDYT? --- gdb/tui/tui-io.c~6 2019-03-17 14:03:10.448181200 +0200 +++ gdb/tui/tui-io.c 2019-03-17 14:03:53.951772800 +0200 @@ -696,12 +696,6 @@ gdb_wgetch (WINDOW *win) nonl (); int r = wgetch (win); nl (); - /* In nonl mode, if the user types Enter, it will not be echoed - properly. This will result in gdb output appearing immediately - after the command. So, if we read \r, emit a \r now, after nl - mode has been re-entered, so that the output looks correct. */ - if (r == '\r') - puts ("\r"); return r; } @@ -928,7 +922,7 @@ tui_getc (FILE *fp) /* The \n must be echoed because it will not be printed by readline. */ - if (ch == '\n') + if (ch == '\n' || ch == '\r') { /* When hitting return with an empty input, gdb executes the last command. If we emit a newline, this fills up the command window