From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [pushed 1/3] [gdb/testsuite] Factor out Term::_scroll
Date: Fri, 16 Oct 2026 13:31:21 +0200 [thread overview]
Message-ID: <20261016113123.6460-2-tdevries@suse.de> (raw)
In-Reply-To: <20261016113123.6460-1-tdevries@suse.de>
Factor Term::_scroll out of Term::_ctl_0x0a.
---
gdb/testsuite/lib/tuiterm.exp | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp
index edabadeb1a3..39fcb082b47 100644
--- a/gdb/testsuite/lib/tuiterm.exp
+++ b/gdb/testsuite/lib/tuiterm.exp
@@ -177,25 +177,27 @@ proc Term::_copy_lines { sy ey dy } {
return $cnt
}
+# Scroll display contents until the cursor is on the display.
+proc Term::_scroll {} {
+ variable _cur_row
+ variable _rows
+
+ while {$_cur_row >= $_rows} {
+ # Scroll the display contents. We scroll one line at
+ # a time here.
+ _copy_lines 1 $_rows 0
+
+ incr _cur_row -1
+ _clear_lines $_cur_row $_rows
+ }
+}
+
# Linefeed.
proc Term::_ctl_0x0a {} {
_log_cur "Line feed" {
variable _cur_row
- variable _rows
-
incr _cur_row 1
- while {$_cur_row >= $_rows} {
- # Scroll the display contents. We scroll one line at
- # a time here; as _cur_row was only increased by one,
- # a single line scroll should be enough to put the
- # cursor back on the screen. But we wrap the
- # scrolling inside a while loop just to be on the safe
- # side.
- _copy_lines 1 $_rows 0
-
- incr _cur_row -1
- _clear_lines $_cur_row $_rows
- }
+ _scroll
}
}
--
2.51.0
next prev parent reply other threads:[~2026-10-16 11:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 11:31 [pushed 0/3] [gdb/testsuite] Fix "FIXME scroll" error in Term::_insert Tom de Vries
2026-10-16 11:31 ` Tom de Vries [this message]
2026-10-16 11:31 ` [pushed 2/3] " Tom de Vries
2026-10-16 11:31 ` [pushed 3/3] [gdb/testsuite] Add gdb.tui/scroll-bottom-right.exp Tom de Vries
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=20261016113123.6460-2-tdevries@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@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