diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2021-01-22 16:25:15 +0000 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2021-02-08 09:51:45 +0000 |
commit | 5fb97639911a4ab55f0287b5deea2f06d83a5f8c (patch) | |
tree | c983cfd40d8351f71a2b0cbb00fd2d05b81c5377 /gdb/testsuite/lib | |
parent | d6f2700b4863f24d8fdab2f549a39a9453b86e93 (diff) | |
download | gdb-5fb97639911a4ab55f0287b5deea2f06d83a5f8c.zip gdb-5fb97639911a4ab55f0287b5deea2f06d83a5f8c.tar.gz gdb-5fb97639911a4ab55f0287b5deea2f06d83a5f8c.tar.bz2 |
gdb/testsuite: fix implementation of delete line in tuiterm.exp
The implementation of the delete line escape sequence in tuiterm.exp
was wrong. Delete should take a count and then delete COUNT lines at
the current cursor location, all remaining lines in the scroll region
are moved up to replace the deleted lines, with blank lines being
added at the end of the scroll region.
It's not clear to me what "scroll region" means here (or at least how
that is defined), but for now I'm just treating the whole screen as
the scroll region, which seems to work fine.
In contrast the current broken implementation deletes COUNT lines at
the cursor location moving the next COUNT lines up to fill the gap.
The rest of the screen is then cleared.
gdb/testsuite/ChangeLog:
* gdb.tui/scroll.exp: New file.
* gdb.tui/tui-layout-asm-short-prog.exp: Update expected results.
* lib/tuiterm.exp (Term::_csi_M): Delete count lines, scroll
remaining lines up.
(Term::check_region_contents): New proc.
(Term::check_box_contents): Use check_region_contents.
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r-- | gdb/testsuite/lib/tuiterm.exp | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp index 4160586..3f6271e 100644 --- a/gdb/testsuite/lib/tuiterm.exp +++ b/gdb/testsuite/lib/tuiterm.exp @@ -367,16 +367,15 @@ namespace eval Term { variable _chars set y $_cur_row - set next_y [expr {$y + 1}] - while {$count > 0 && $next_y < $_rows} { + set next_y [expr {$y + $count}] + while {$next_y < $_rows} { for {set x 0} {$x < $_cols} {incr x} { set _chars($x,$y) $_chars($x,$next_y) } incr y incr next_y - incr count -1 } - _clear_lines $next_y $_rows + _clear_lines $y $_rows } } @@ -789,6 +788,33 @@ namespace eval Term { } } + # Check that the region of the screen described by X, Y, WIDTH, + # and HEIGHT match REGEXP. This is like check_contents except + # only part of the screen is checked. This can be used to check + # the contents within a box (though check_box_contents is a better + # choice for boxes with a border). + proc check_region_contents { test_name x y width height regexp } { + variable _chars + + # Now grab the contents of the box, join each line together + # with a '\r\n' sequence and match against REGEXP. + set result "" + for {set yy $y} {$yy < [expr {$y + $height}]} {incr yy} { + if {$yy > $y} { + # Add the end of line sequence only if this isn't the + # first line. + append result "\r\n" + } + for {set xx $x} {$xx < [expr {$x + $width}]} {incr xx} { + append result [lindex $_chars($xx,$yy) 0] + } + } + + if {![gdb_assert {[regexp -- $regexp $result]} $test_name]} { + dump_screen + } + } + # Check the contents of a box on the screen. This is a little # like check_contents, but doens't check the whole screen # contents, only the contents of a single box. This procedure @@ -805,19 +831,8 @@ namespace eval Term { return } - # Now grab the contents of the box, join each line together - # with a newline character and match against REGEXP. - set result "" - for {set yy [expr {$y + 1}]} {$yy < [expr {$y + $height - 1}]} {incr yy} { - for {set xx [expr {$x + 1}]} {$xx < [expr {$x + $width - 1}]} {incr xx} { - append result [lindex $_chars($xx,$yy) 0] - } - append result "\n" - } - - if {![gdb_assert {[regexp -- $regexp $result]} $test_name]} { - dump_screen - } + check_region_contents $test_name [expr {$x + 1}] [expr {$y + 1}] \ + [expr {$width - 2}] [expr {$height - 2}] $regexp } # A debugging function to dump the current screen, with line |