From patchwork Sat Jan 12 20:40:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 31044 Received: (qmail 21983 invoked by alias); 12 Jan 2019 20:40:26 -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 21914 invoked by uid 89); 12 Jan 2019 20:40:26 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1159, pressing, window X-HELO: gateway21.websitewelcome.com Received: from gateway21.websitewelcome.com (HELO gateway21.websitewelcome.com) (192.185.45.36) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 12 Jan 2019 20:40:23 +0000 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway21.websitewelcome.com (Postfix) with ESMTP id A83D9401114C5 for ; Sat, 12 Jan 2019 14:40:22 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id iQ4sg4DUN2PzOiQ4sghjGF; Sat, 12 Jan 2019 14:40:22 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version :Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=WQexcBNbqxiEdNc1zZZGjX/VW6R0aW+B9Xfm+9MwUBc=; b=b/NpQB/kto+mtRqS6ge5m/nYoF 5EYu5RJFMTsuWq8eh+Fg4KmRHTSyUpuHbhtK7xg+A2NV6U1R29G+HEBZlYYkjgOG3gKz5lfJVxgeV 2I/cGB4fneoHUuUhcTMJiLgsz; Received: from 75-166-72-210.hlrn.qwest.net ([75.166.72.210]:56526 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1giQ4s-002rzb-Fg; Sat, 12 Jan 2019 14:40:22 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Fix placement of output in TUI mode Date: Sat, 12 Jan 2019 13:40:20 -0700 Message-Id: <20190112204020.26388-1-tom@tromey.com> The fix for PR tui/28819 regressed gdb command output a bit. In "nonl" mode, pressing the Enter key will result in a newline not being echoed properly, so that gdb output for the command will begin on the same line as the input. This patch changes gdb_wgetch to echo the newline. I have only tested this interactively, as the TUI doesn't have automated tests in general. gdb/ChangeLog 2019-01-12 Tom Tromey PR tui/28819: * tui/tui-io.c (gdb_wgetch): Print \r when needed. --- gdb/ChangeLog | 5 +++++ gdb/tui/tui-io.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c index 0e53350820..9191ccae7e 100644 --- a/gdb/tui/tui-io.c +++ b/gdb/tui/tui-io.c @@ -609,6 +609,12 @@ 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; }