From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 9B04C385841C for ; Sun, 6 Feb 2022 14:13:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9B04C385841C Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-201-YTbt9UEINo6zZ2i7X_Dx3g-1; Sun, 06 Feb 2022 09:13:07 -0500 X-MC-Unique: YTbt9UEINo6zZ2i7X_Dx3g-1 Received: by mail-ed1-f69.google.com with SMTP id l14-20020aa7cace000000b003f7f8e1cbbdso6103137edt.20 for ; Sun, 06 Feb 2022 06:13:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UaGTvPegbhRxo7MNKp91vn1+uZZojBuIDE45eDItpUU=; b=lDDchamLEgasorxBh8YVjvtD1jj1eEPa1/b1gho9P/lGHPBNqN+Ddh9p4/LeiGsei+ QwJdEdx1jKSgwUf8ZNLjQJftGK7j1kJqvGL2+b9Dy32hGOMuAq5piZmbGEZlLpM9bk05 3eR/oZvOxPIl+U7ZcXPNigW/9ZzoRwpIb2a1pc002LbcSFBTJKCExNaa0pepjICAGtsW uKxcL+o//z+4go7Fy2VhYuFlOPygir95LJ3kYskWArOQuG89siLF13NmQq5n434rNNxw WTpAlhHLfGiVCE+J+X9gE1kld2LJnwy41x0QFoeN4zJ7Vyai+4N+Mo/u8dz1zMorZxUd /XAw== X-Gm-Message-State: AOAM532VJ9vE8ZYaACwboltBujiPZWYJEBP0ZgIgN0kpJqi0brkA/uv5 y8lgKl0NlMU03wBLniuWJ3ASVQbhDhG/ZWvmwZhyIIxe4mT6MXQW6itqSyKYBU0wxjGxC236tBn CKWGLHz3uDwUn3O+YtgbOWTGMld9yPouwu3yvUtJhZBUleDKW85e7ytIFd+mLmQx9GJOOlJnIAQ == X-Received: by 2002:aa7:dd0b:: with SMTP id i11mr4397846edv.81.1644156786251; Sun, 06 Feb 2022 06:13:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJyE0jEsDaYE824tBhst4JUfIN5P5YGTOgWND0l2H9GtJS5VPw5TZ3s8ttXcRMLn9NPdF3eqMQ== X-Received: by 2002:aa7:dd0b:: with SMTP id i11mr4397830edv.81.1644156786026; Sun, 06 Feb 2022 06:13:06 -0800 (PST) Received: from localhost (92.40.178.36.threembb.co.uk. [92.40.178.36]) by smtp.gmail.com with ESMTPSA id z5sm2615304eja.20.2022.02.06.06.13.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 06:13:05 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv2 04/15] gdb/testing/tui: add new functionality to tuiterm.exp Date: Sun, 6 Feb 2022 14:12:42 +0000 Message-Id: X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Feb 2022 14:13:12 -0000 While working on later patches in this series, I was running into csi control codes being emitted from ncurses that are not currently handled by out gdb/testsuite/lib/tuiterm.exp. This commit adds support for these additional control sequences. The new sequences are 'Insert Line', 'Delete Characters', and 'Scroll Down'. There are no new tests in this commit, but I was running into these sequences while developing later patches in this series. However, which control sequences ncurses emits can vary wildly depending on the screen contents. It is possible that I only hit some of these sequences while debugging the later patches (i.e. printing extra content to the terminal), some of these might no longer be needed given the tests as now written. Still, I think it is worth merging these to improve tuiterm.exp. Additionally, I noticed a bug in 'Erase in Line' that this commit fixes; in mode 1 the erase should be from the start of the line through to the cursor, not to the character before the cursor. This bug would mean that random characters would sometimes be left in the terminal output. --- gdb/testsuite/lib/tuiterm.exp | 82 ++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp index 38948015e96..06d2e091ca5 100644 --- a/gdb/testsuite/lib/tuiterm.exp +++ b/gdb/testsuite/lib/tuiterm.exp @@ -317,13 +317,40 @@ namespace eval Term { # From cursor to end. _clear_in_line $_cur_col $_cols $_cur_row } elseif {$arg == 1} { - _clear_in_line 0 $_cur_col $_cur_row + _clear_in_line 0 [expr $_cur_col + 1] $_cur_row } elseif {$arg == 2} { _clear_in_line 0 $_cols $_cur_row } } } + # 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 + 1] + 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 $_rows + } + } + # Delete line. # # https://vt100.net/docs/vt510-rm/DL.html @@ -349,6 +376,59 @@ namespace eval Term { } } + # Delete Characters + # + # https://vt100.net/docs/vt510-rm/DCH.html + proc _csi_P {args} { + set count [_default [lindex $args 0] 1] + + _log_cur "Delete Character ($count)" { + variable _cur_col + variable _cur_row + variable _cols + variable _chars + + set dx [expr $_cur_col + 1] + set sx [expr $_cur_col + 1 + $count] + set y $_cur_row + + while {$sx < $_cols} { + set _chars($dx,$y) $_chars($sx,$y) + incr sx + incr dx + } + _clear_in_line $dx $sx $y + } + } + + # 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 + + 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 + } + } + # Erase chars. # # https://vt100.net/docs/vt510-rm/ECH.html -- 2.25.4