public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.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	[thread overview]
Message-ID: <bug-30337-4717-MQccvRS0w4@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-30337-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=30337

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
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=xterm 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=ansi 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=40, then ask readline how wide
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=ansi gdb -q
         1         2         3         4
1234567890123456789012345678901234567890
(gdb) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aa
...
wrapping after 39 chars, as expected.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2023-04-12 13:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-12 11:15 [Bug tui/30337] New: [gdb/tui] TUI in ansi terminal has one off " vries at gcc dot gnu.org
2023-04-12 11:15 ` [Bug tui/30337] [gdb/tui] TUI in ansi terminal has off-by-one " vries at gcc dot gnu.org
2023-04-12 11:48 ` vries at gcc dot gnu.org
2023-04-12 12:45 ` vries at gcc dot gnu.org
2023-04-12 13:56 ` vries at gcc dot gnu.org [this message]
2023-04-13 12:43 ` vries at gcc dot gnu.org
2023-04-13 14:11 ` vries at gcc dot gnu.org
2023-04-30 11:06 ` cvs-commit at gcc dot gnu.org
2023-04-30 11:10 ` vries at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-30337-4717-MQccvRS0w4@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).