From patchwork Tue Apr 11 08:23:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 67622 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A8D3F385772F for ; Tue, 11 Apr 2023 08:23:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A8D3F385772F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681201428; bh=Vpzqpk8sUiJFCxfIAwQ7wBxg8N55fV6GalnqXK2juSQ=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=TW9PKSeU5Imcjp5MyUm9PgFFlnSnle1gkVUMcxAqU0y350qVaQFKyc+uZA6+nyM2B gPpYSeSuo9DzsT95Px7dF1edXCdI0t5HYCSUA5TF4QudX01wxYHgWcDqbgn05U7+cb anbbBgOC70DO40eDJh+NOoX09wkGhkqlVnieSQVg= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id 3899C3858C5E for ; Tue, 11 Apr 2023 08:23:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3899C3858C5E Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 537C121A59; Tue, 11 Apr 2023 08:23:24 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 39D9013638; Tue, 11 Apr 2023 08:23:24 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id YHQZDfwYNWRpBAAAMHmgww (envelope-from ); Tue, 11 Apr 2023 08:23:24 +0000 To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 3/3] [gdb/tui] Revert workaround in tui_source_window::show_line_number Date: Tue, 11 Apr 2023 10:23:32 +0200 Message-Id: <20230411082332.25052-3-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230411082332.25052-1-tdevries@suse.de> References: <20230411082332.25052-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" The m_digits member of tui_source_window is documented as having semantics: ... /* How many digits to use when formatting the line number. This includes the trailing space. */ ... The commit 1b6d4bb2232 ("Redraw both spaces between line numbers and source code") started printing two trailing spaces instead: ... - xsnprintf (text, sizeof (text), "%*d ", m_digits - 1, lineno); + xsnprintf (text, sizeof (text), "%*d ", m_digits - 1, lineno); ... Now that PR30325 is fixed, this no longer has any effect. Fix this by reverting to the original behaviour: print one trailing space char. Tested on x86_64-linux. --- gdb/tui/tui-source.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c index aa3e58407c4..3d08ea8b7cd 100644 --- a/gdb/tui/tui-source.c +++ b/gdb/tui/tui-source.c @@ -232,11 +232,9 @@ tui_source_window::show_line_number (int offset) const { int lineno = m_content[0].line_or_addr.u.line_no + offset; char text[20]; - /* To completely overwrite the previous border when the source window height - is increased, both spaces after the line number have to be redrawn. */ char space = tui_left_margin_verbose ? '_' : ' '; xsnprintf (text, sizeof (text), - tui_left_margin_verbose ? "%0*d%c%c" : "%*d%c%c", m_digits - 1, - lineno, space, space); + tui_left_margin_verbose ? "%0*d%c" : "%*d%c", m_digits - 1, + lineno, space); waddstr (handle.get (), text); }