aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2022-01-26 18:41:59 +0000
committerAndrew Burgess <aburgess@redhat.com>2022-04-01 16:22:01 +0100
commitfd46a69ed42ce16fbbf5a20dffca9228a3647019 (patch)
tree5545dab554635027efaaac88168b8db295175738 /gdb
parent801a7eab11e9050c64a229c6a24d2994df3ca0d4 (diff)
downloadbinutils-fd46a69ed42ce16fbbf5a20dffca9228a3647019.zip
binutils-fd46a69ed42ce16fbbf5a20dffca9228a3647019.tar.gz
binutils-fd46a69ed42ce16fbbf5a20dffca9228a3647019.tar.bz2
gdb/testing/tui: add new _csi_{L,S,T}
This patch was original part of this series: https://sourceware.org/pipermail/gdb-patches/2022-March/186429.html https://sourceware.org/pipermail/gdb-patches/2022-March/186433.html I've pulled this out as it might be useful ahead of the bigger series being merged. This commit adds: _csi_L - insert line _csi_S - pan down _csi_T - pan up
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/gdb.tui/tuiterm.exp85
-rw-r--r--gdb/testsuite/lib/tuiterm.exp95
2 files changed, 180 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.tui/tuiterm.exp b/gdb/testsuite/gdb.tui/tuiterm.exp
index c82db21..98f1cd7 100644
--- a/gdb/testsuite/gdb.tui/tuiterm.exp
+++ b/gdb/testsuite/gdb.tui/tuiterm.exp
@@ -179,6 +179,60 @@ proc test_insert_characters { } {
} 0 1
}
+proc test_pan_down { } {
+ Term::_move_cursor 1 2
+ Term::_csi_S
+ check "pan down, default arg" {
+ "ijklmnop"
+ "qrstuvwx"
+ "yz01234 "
+ " "
+ } 1 2
+
+ Term::_csi_S 2
+ check "pan down, explicit arg" {
+ "yz01234 "
+ " "
+ " "
+ " "
+ } 1 2
+
+ Term::_csi_S 100
+ check "pan down, excessive arg" {
+ " "
+ " "
+ " "
+ " "
+ } 1 2
+}
+
+proc test_pan_up { } {
+ Term::_move_cursor 1 2
+ Term::_csi_T
+ check "pan down, default arg" {
+ " "
+ "abcdefgh"
+ "ijklmnop"
+ "qrstuvwx"
+ } 1 2
+
+ Term::_csi_T 2
+ check "pan down, explicit arg" {
+ " "
+ " "
+ " "
+ "abcdefgh"
+ } 1 2
+
+ Term::_csi_T 100
+ check "pan down, excessive arg" {
+ " "
+ " "
+ " "
+ " "
+ } 1 2
+}
+
proc test_cursor_up { } {
Term::_move_cursor 2 3
@@ -594,6 +648,34 @@ proc test_vertical_line_position_absolute { } {
} 2 3
}
+proc test_insert_line { } {
+ Term::_move_cursor 2 1
+ Term::_csi_L
+ check "insert line, default param" {
+ "abcdefgh"
+ " "
+ "ijklmnop"
+ "qrstuvwx"
+ } 2 1
+
+ Term::_move_cursor 2 0
+ Term::_csi_L 2
+ check "insert line, explicit param" {
+ " "
+ " "
+ "abcdefgh"
+ " "
+ } 2 0
+
+ Term::_csi_L 12
+ check "insert line, insert more lines than display has" {
+ " "
+ " "
+ " "
+ " "
+ } 2 0
+}
+
# Run proc TEST_PROC_NAME with a "small" terminal.
proc run_one_test_small { test_proc_name } {
@@ -632,6 +714,9 @@ foreach_with_prefix test {
test_erase_character
test_repeat
test_vertical_line_position_absolute
+ test_insert_line
+ test_pan_up
+ test_pan_down
} {
run_one_test_small $test
}
diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp
index 9053f7d..e660840 100644
--- a/gdb/testsuite/lib/tuiterm.exp
+++ b/gdb/testsuite/lib/tuiterm.exp
@@ -324,6 +324,33 @@ namespace eval Term {
}
}
+ # Insert Line
+ #
+ # https://vt100.net/docs/vt510-rm/IL.html
+ proc _csi_L {args} {
+ set arg [_default [lindex $args 0] 1]
+
+ _log_cur "Insert Line ($arg)" {
+ variable _cur_col
+ variable _cur_row
+ variable _rows
+ variable _cols
+ variable _chars
+
+ set y [expr $_rows - 2]
+ set next_y [expr $y + $arg]
+ while {$y >= $_cur_row} {
+ for {set x 0} {$x < $_cols} {incr x} {
+ set _chars($x,$next_y) $_chars($x,$y)
+ }
+ incr y -1
+ incr next_y -1
+ }
+
+ _clear_lines $_cur_row [expr $_cur_row + $arg]
+ }
+ }
+
# Delete line.
#
# https://vt100.net/docs/vt510-rm/DL.html
@@ -376,6 +403,74 @@ namespace eval Term {
}
}
+ # Pan Down
+ #
+ # https://vt100.net/docs/vt510-rm/SU.html
+ proc _csi_S {args} {
+ set count [_default [lindex $args 0] 1]
+
+ _log_cur "Pan Down ($count)" {
+ variable _cur_col
+ variable _cur_row
+ variable _cols
+ variable _rows
+ variable _chars
+
+ # The following code is written without consideration for
+ # the scroll margins. At this time this comment was
+ # written the tuiterm library doesn't support the scroll
+ # margins. If/when that changes, then the following will
+ # need to be updated.
+
+ set dy 0
+ set y $count
+
+ while {$y < $_rows} {
+ for {set x 0} {$x < $_cols} {incr x} {
+ set _chars($x,$dy) $_chars($x,$y)
+ }
+ incr y 1
+ incr dy 1
+ }
+
+ _clear_lines $dy $_rows
+ }
+ }
+
+ # Pan Up
+ #
+ # https://vt100.net/docs/vt510-rm/SD.html
+ proc _csi_T {args} {
+ set count [_default [lindex $args 0] 1]
+
+ _log_cur "Pan Up ($count)" {
+ variable _cur_col
+ variable _cur_row
+ variable _cols
+ variable _rows
+ variable _chars
+
+ # The following code is written without consideration for
+ # the scroll margins. At this time this comment was
+ # written the tuiterm library doesn't support the scroll
+ # margins. If/when that changes, then the following will
+ # need to be updated.
+
+ set y [expr $_rows - $count]
+ set dy $_rows
+
+ while {$dy >= $count} {
+ for {set x 0} {$x < $_cols} {incr x} {
+ set _chars($x,$dy) $_chars($x,$y)
+ }
+ incr y -1
+ incr dy -1
+ }
+
+ _clear_lines 0 $count
+ }
+ }
+
# Erase chars.
#
# https://vt100.net/docs/vt510-rm/ECH.html