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 cli/30346] New: [gdb/cli] CLI in ansi terminal has off-by-one width problem
Date: Thu, 13 Apr 2023 12:42:28 +0000	[thread overview]
Message-ID: <bug-30346-4717@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 30346
           Summary: [gdb/cli] CLI in ansi terminal has off-by-one width
                    problem
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: cli
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

[ Previously filed at PR30337 comment 3. ]

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.

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

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

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-13 12:42 vries at gcc dot gnu.org [this message]
2023-04-15  6:10 ` [Bug cli/30346] " vries at gcc dot gnu.org
2023-04-21 15:12 ` cvs-commit at gcc dot gnu.org
2023-05-05 12:34 ` cvs-commit at gcc dot gnu.org
2023-05-12  9:43 ` cvs-commit at gcc dot gnu.org
2023-05-12  9:46 ` 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-30346-4717@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).