From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1726) id 5BEC73858C2F; Fri, 27 Jan 2023 16:25:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5BEC73858C2F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1674836703; bh=Q3G9raeaVYduKZRf8M0U4fCllR2vafWZcEklBjYkwOY=; h=From:To:Subject:Date:From; b=m9QMOO4kVY2aYVBa/A+w8mkiJQQrHPuDXDCmlfgy9rrBrFfOO9knxRzLHmC/PbBvl TBoJx251dW7CyTuj7lZINsENeqhwmo2iArrAnwwadTUKjOF6zvVPhvSqzhrSMmASvx T1efTGYNe7T/FO3E6Cv9a4O7RRIlkymXcvV/92s0= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Andrew Burgess To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/testsuite: fix line feed scrolling in tuiterm.exp X-Act-Checkin: binutils-gdb X-Git-Author: Andrew Burgess X-Git-Refname: refs/heads/master X-Git-Oldrev: 1c66b8a03989b963534689ec0a9cce57e419afd5 X-Git-Newrev: efe1b6507b7e6ae5ee45af5b1568b910a3170750 Message-Id: <20230127162503.5BEC73858C2F@sourceware.org> Date: Fri, 27 Jan 2023 16:25:03 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Defe1b6507b7e= 6ae5ee45af5b1568b910a3170750 commit efe1b6507b7e6ae5ee45af5b1568b910a3170750 Author: Andrew Burgess Date: Thu Dec 22 16:26:50 2022 +0000 gdb/testsuite: fix line feed scrolling in tuiterm.exp =20 In a following commit I managed to trigger the line feed scrolling case in tuiterm.exp. This case is currently unhandled, and this commit fills in this missing functionality. =20 The implementation is pretty simple, just scroll all the content up one line at a time until the cursor is back on the screen (a single line of scroll is all that should be needed). =20 This change is untested in this commit, but is required by the next commit. Diff: --- gdb/testsuite/lib/tuiterm.exp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp index c38ccbbdbd7..8a3f7a48acc 100644 --- a/gdb/testsuite/lib/tuiterm.exp +++ b/gdb/testsuite/lib/tuiterm.exp @@ -99,10 +99,24 @@ namespace eval Term { _log_cur "Line feed" { variable _cur_row variable _rows + variable _cols + variable _chars =20 incr _cur_row 1 - if {$_cur_row >=3D $_rows} { - error "FIXME scroll" + while {$_cur_row >=3D $_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. + for {set y 0} {$y < [expr $_rows - 1]} {incr y} { + set next_y [expr $y + 1] + for {set x 0} {$x < $_cols} {incr x} { + set _chars($x,$y) $_chars($x,$next_y) + } + incr _cur_row -1 + } } } }