* [pushed] [gdb/testsuite] Fix linefeed scrolling in tuiterm
@ 2023-05-29 20:11 Tom de Vries
0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2023-05-29 20:11 UTC (permalink / raw)
To: gdb-patches
I came across a bug in the implementation of line feed in tuiterm, and added a
unit test that exposes it.
Before sending the line feed we have:
...
Screen Dump (size 8 columns x 4 rows, cursor at column 0, row 3):
0 abcdefgh
1 ijklmnop
2 qrstuvwx
3 yz01234
...
and after it we have:
...
Screen Dump (size 8 columns x 4 rows, cursor at column 0, row 1):
0 ijklmnop
1 qrstuvwx
2 yz01234
3 yz01234
...
Note how the cursor started at row 3 and after the line feed ended up at
row 1, while it should have stayed in row 3.
Fix this by moving "incr _cur_row -1" one level up in the loop nest in
proc _ctl_0x0a.
Tested on x86_64-linux.
---
gdb/testsuite/gdb.tui/tuiterm.exp | 13 +++++++++++++
gdb/testsuite/lib/tuiterm.exp | 3 ++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.tui/tuiterm.exp b/gdb/testsuite/gdb.tui/tuiterm.exp
index c1751418130..74800d9af9d 100644
--- a/gdb/testsuite/gdb.tui/tuiterm.exp
+++ b/gdb/testsuite/gdb.tui/tuiterm.exp
@@ -131,6 +131,18 @@ proc test_linefeed { } {
} 1 3
}
+proc test_linefeed_scroll { } {
+ Term::_move_cursor 0 3
+ Term::_ctl_0x0a
+ check "linefeed_scroll" {
+ "ijklmnop"
+ "qrstuvwx"
+ "yz01234 "
+ "yz01234 "
+ } 0 3
+ Term::dump_screen
+}
+
proc test_carriage_return { } {
Term::_move_cursor 1 2
Term::_ctl_0x0d
@@ -761,6 +773,7 @@ proc run_one_test_large { test_proc_name } {
foreach_with_prefix test {
test_backspace
test_linefeed
+ test_linefeed_scroll
test_carriage_return
test_insert_characters
test_cursor_up
diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp
index b7c877593b7..96f9b9d2bc3 100644
--- a/gdb/testsuite/lib/tuiterm.exp
+++ b/gdb/testsuite/lib/tuiterm.exp
@@ -115,8 +115,9 @@ namespace eval Term {
for {set x 0} {$x < $_cols} {incr x} {
set _chars($x,$y) $_chars($x,$next_y)
}
- incr _cur_row -1
}
+
+ incr _cur_row -1
}
}
}
base-commit: f818c32ba4596a60e77b464cb690aea65ed31346
--
2.35.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-05-29 20:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-29 20:11 [pushed] [gdb/testsuite] Fix linefeed scrolling in tuiterm Tom de Vries
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).