From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 76A9B3858D39; Wed, 12 Apr 2023 13:56:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 76A9B3858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681307770; bh=GVOi7DO0inh2qPlMviKtJLqY/5DVW1nHy8yJPjrP/Ow=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Esa8PBRwf6ZiIAHSNYQ9ukgcbbqVuEPO4D33gzK2NkqgC/abtCKWYDB2/Uw4h4ZZL lUmOh3QN90Rc3PDyRTeTcH5DbE0qaQqYRHR4r3Xv9IT1jUB+FBXydYaNYMYlQJLfxx Y1C95swtVlW29zZ1CRx7mjijBwqQACy1J2cVmCNQ= From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug tui/30337] [gdb/tui] TUI in ansi terminal has off-by-one width problem Date: Wed, 12 Apr 2023 13:56:10 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: tui X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vries 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=3D30337 --- Comment #3 from Tom de Vries --- The problem manifest outside of TUI as well. Say we have a terminal with: ... $ echo $COLUMNS 40 ... For contrast, lets start with the terminal in xterm mode, and type 'a' for a while: ... $ TERM=3Dxterm gdb -q 1 2 3 4 1234567890123456789012345678901234567890 (gdb) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aa ... All 40 positions in the line are used, before we wrap to the next line. Now we start gdb with the terminal in ansi mode: ... $ TERM=3Dansi gdb -q 1 2 3 4 1234567890123456789012345678901234567890 (gdb) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aa ... The line wraps after 38 chars. Based on the readline behaviour of hiding one char to deal with the lack of autowrap, we'd expect wrapping after 39 chars. The problem is that we start out with COLUMNS=3D40, then ask readline how w= ide the screen is, which replies 39. Then we use the 39 to set the screensize using readline, which results in an effective width of 38. With the patch, we have instead: ... $ TERM=3Dansi gdb -q 1 2 3 4 1234567890123456789012345678901234567890 (gdb) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aa ... wrapping after 39 chars, as expected. --=20 You are receiving this mail because: You are on the CC list for the bug.=