From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id C95463858C5F for ; Thu, 11 May 2023 14:55:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C95463858C5F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [172.16.0.192] (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 644C91E114; Thu, 11 May 2023 10:55:29 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1683816929; bh=DyMxAx58dVolDKF1mzKgF6MI7j8JWZTuCpLz9cMXtm8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=WPr58eUFP3diWQ3bA4QG0opQXhFxhFYJ3BAbb8tYpf3aOc155CqqvtRU7yN6ku+2U XzB9UgCCVWODCaCPRSdMVOK1mzhhjBHpnBDxIUCZRLmYgI2evD/aZIgZ/LYNsnUij6 t2q5Bawe7DBGhNAOihdxxhO8uIt+NGhbym/jbdZU= Message-ID: Date: Thu, 11 May 2023 10:55:28 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH] [gdb/tui] Fix tui compact-source a bit more To: Tom de Vries , gdb-patches@sourceware.org Cc: Andrew Burgess References: <20230510132118.13761-1-tdevries@suse.de> Content-Language: fr From: Simon Marchi In-Reply-To: <20230510132118.13761-1-tdevries@suse.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_ASCII_DIVIDERS,KAM_SHORT,NICE_REPLY_A,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 5/10/23 09:21, Tom de Vries via Gdb-patches wrote: > Andrew pointed out that the behaviour as tested in gdb.tui/compact-source.exp > is incorrect: > ... > 0 +-compact-source.c--------------------------------------------------------+ > 1 |___3_{ | > 2 |___4_ return 0; | > 3 |___5_} | > 4 |___6_ | > 5 |___7_ | > 6 |___8_ | > 7 |___9_ | > 8 +-------------------------------------------------------------------------+ > ... > > The last line number in the source file is 5, and there are 7 lines to display > source lines, so if we'd scroll all the way down, the first line number in the > source window would be 5, and the last one would be 11. > > To represent 11 we'd need 2 digits, so we expect to see ___04_ here instead of > ___4_, even though all line numbers currently in the src window (3-9) can be > represented with only 1 digit. Just wondering: it makes sense to let the user scroll down all the way, until the point where line 5 is the first line in the window. However, do we need to print line numbers for lines that are after the end of the source file? In other words, could we leave lines 6-11 blank, and therefore we could keep using just one digit? Simon