From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id F1A63385842D; Fri, 21 Apr 2023 15:12:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F1A63385842D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1682089954; bh=8ohXSBNoPXf88VbkcobgQNH3aifh8ZBeQafLgQ//qsk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=aVbycnIm9XIwXZkCIiDOJL2R/CEMO1gfMazQOAwTLFxJDGWwLcUIL5uZ6thAhtBBK TZxR0/TYF8QizOUevjXBlC79TcbIEe3zKEVhCPBLgCuhHsA2I0utBe/d+wt5jQJvdO skibbMQS8N6LYRh6q9NJ6AagVsEWdAvzTXl3Efic= From: "cvs-commit at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug cli/30346] [gdb/cli] CLI in ansi terminal has off-by-one width problem Date: Fri, 21 Apr 2023 15:12:34 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: cli X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30346 --- Comment #2 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by Tom de Vries : https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Df1531d046178= fbdd97e3440e3d454683440b75f9 commit f1531d046178fbdd97e3440e3d454683440b75f9 Author: Tom de Vries Date: Fri Apr 21 17:12:23 2023 +0200 [gdb/cli] Add maint info screen While working on PRs tui/30337 and cli/30346 I came across various noti= ons of width in gdb, as reported by gdb, readline, curses and the environment variables. As for gdb, readline and the environment variables, the way things work is: - Gdb asks readline to detect screen size, - readline sets the actual screen size in the environment variables COLUMNS and LINES, - readline reports back a screen size to gdb, which may have one column less than the actual screen size, to deal with lack of auto-wrap. This becomes gdb's notion of screen size (in other words the point wh= ere we can expect the gdb command line to wrap), - Gdb then explicitly sets readline's screen size, which readline itself may adjust to deal with lack of auto-wrap. This becomes readlines notion of screen size (well, internally the unadjusted one, but it'll report back the adjusted one). Add a command "maint info screen" that prints these notions, both for w= idth and height. For TERM=3Dxterm we have: ... $ TERM=3Dxterm gdb -ex "maint info screen" Number of characters gdb thinks are in a line is 118. Number of characters readline reports are in a line is 118. Number of characters curses thinks are in a line is 118. Number of characters environment thinks are in a line is 118 (COLUMNS). Number of lines gdb thinks are in a page is 27. Number of lines readline reports are in a page is 27. Number of lines curses thinks are in a page is 27. Number of lines environment thinks are in a page is 27 (LINES). ... And for TERM=3Dansi: ... $ TERM=3Dansi gdb -ex "maint info screen" Number of characters gdb thinks are in a line is 117. Number of characters readline reports are in a line is 116. Number of characters curses thinks are in a line is 118. Number of characters environment thinks are in a line is 118 (COLUMNS). Number of lines gdb thinks are in a page is 27. Number of lines readline reports are in a page is 27. Number of lines curses thinks are in a page is 27. Number of lines environment thinks are in a page is 27 (LINES). ... [ The fact that we have "characters readline reports are in a line is 1= 16" is is due to gdb making readline adjust twice for the lack of auto-wrap, t= his is PR cli/30346. Likewise we can detect tui/30337 by doing a resize in TUI mode and doing "maint info screen": ... Number of characters characters curses thinks are in a line is 110. Number of characters environment thinks are in a line is 111 (COLUMNS).= ] And for TERM=3Dansi, with width and heigth set to 0: ... Number of characters gdb thinks are in a line is 4294967295 (unlimited). Number of characters readline reports are in a line is 32766 (unlimited= - 1). Number of characters curses thinks are in a line is 118. Number of characters environment thinks are in a line is 118 (COLUMNS). Number of lines gdb thinks are in a page is 4294967295 (unlimited). Number of lines readline reports are in a page is 32767 (unlimited). Number of lines curses thinks are in a page is 27. Number of lines environment thinks are in a page is 27 (LINES). ... [ Note that when doing a resize by say maximizing or de-maximizing a terminal, all reported values are updated, except for curses when not in TUI mode. Maybe that means there's a bug. If not, then maybe we should not print the curses lines unless in TUI mode, or annotate those lines such that = it's clear that the values may be not up-to-date. ] I'd like to use this command in the regression test for PR cli/30346. Tested on x86_64-linux. Reviewed-By: Eli Zaretskii Reviewed-By: Tom Tromey --=20 You are receiving this mail because: You are on the CC list for the bug.=