public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit 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: Sun, 30 Apr 2023 11:06:11 +0000 [thread overview] Message-ID: <bug-30337-4717-eLDo0gryIS@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 #6 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Tom de Vries <vries@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=deb1ba4e38bf1427d4297b1e9b3e5e73cbc9e456 commit deb1ba4e38bf1427d4297b1e9b3e5e73cbc9e456 Author: Tom de Vries <tdevries@suse.de> Date: Sun Apr 30 13:06:23 2023 +0200 [gdb/tui] Fix TUI resizing for TERM=ansi With TERM=ansi, when resizing a TUI window from LINES/COLUMNS 31/118 (maximized) to 20/78 (de-maximized), I get a garbled screen (that ^L doesn't fix) and a message: ... @@ resize done 0, size = 77x20 ... with the resulting width being 77 instead of the expected 78. [ The discrepancy also manifests in CLI, filed as PR30346. ] The discrepancy comes from tui_resize_all, where we ask readline for the screen size: ... rl_get_screen_size (&screenheight, &screenwidth); ... As it happens, when TERM is set to ansi, readline decides that the terminal cannot auto-wrap lines, and reserves one column to deal with that, and as a result reports back one less than the actual screen width: ... $ echo $COLUMNS 78 $ TERM=xterm gdb -ex "show width" -ex q Number of characters gdb thinks are in a line is 78. $ TERM=ansi gdb -ex "show width" -ex q Number of characters gdb thinks are in a line is 77. ... In tui_resize_all, we need the actual screen width, and using a screenwidth of one less than the actual value garbles the screen. This is currently not causing trouble in testing because we have a workaround in place in proc Term::resize. If we disable the workaround: ... - stty columns [expr {$_cols + 1}] < $::gdb_tty_name + stty columns $_cols < $::gdb_tty_name ... and dump the screen we get the same type of screen garbling: ... 0 +---------------------------------------+| 1 || 2 || 3 || ... Another way to reproduce the problem is using command "maint info screen". After starting gdb with TERM=ansi, entering TUI, and issuing the command, we get: ... Number of characters curses thinks are in a line is 78. ... and after maximizing and demaximizing the window we get: ... Number of characters curses thinks are in a line is 77. ... If we use TERM=xterm, we do get the expected 78. Fix this by: - detecting when readline will report back less than the actual screen width, - accordingly setting a new variable readline_hidden_cols, - using readline_hidden_cols in tui_resize_all to fix the resize problem, and - removing the workaround in Term::resize. The test-case gdb.tui/empty.exp serves as regression test. I've applied the same fix in tui_async_resize_screen, the new test-case gdb.tui/resize-2.exp serves as a regression test for that change. Without that fix, we have: ... FAIL: gdb.tui/resize-2.exp: again: gdb width 80 ... Tested on x86_64-linux. PR tui/30337 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30337 -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2023-04-30 11:06 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 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 [this message] 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-eLDo0gryIS@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: linkBe 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).