public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] gdb/testsuite: fix line feed scrolling in tuiterm.exp
Date: Fri, 27 Jan 2023 16:25:03 +0000 (GMT)	[thread overview]
Message-ID: <20230127162503.5BEC73858C2F@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=efe1b6507b7e6ae5ee45af5b1568b910a3170750

commit efe1b6507b7e6ae5ee45af5b1568b910a3170750
Author: Andrew Burgess <aburgess@redhat.com>
Date:   Thu Dec 22 16:26:50 2022 +0000

    gdb/testsuite: fix line feed scrolling in tuiterm.exp
    
    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.
    
    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).
    
    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
 
 	    incr _cur_row 1
-	    if {$_cur_row >= $_rows} {
-		error "FIXME scroll"
+	    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.
+		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
+		}
 	    }
 	}
     }

                 reply	other threads:[~2023-01-27 16:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230127162503.5BEC73858C2F@sourceware.org \
    --to=aburgess@sourceware.org \
    --cc=gdb-cvs@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).