public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH] gdb/testsuite/tui: implement _csi_P proc
Date: Tue, 29 Mar 2022 21:24:11 -0400	[thread overview]
Message-ID: <20220330012411.2993199-1-simon.marchi@efficios.com> (raw)

Since commit 3cd522938792 ("Change the pager to a ui_file"), I see these
errors when running gdb.tui/scroll.exp:

    ERROR: invalid command name "_csi_P"
        while executing
    "::gdb_tcl_unknown _csi_P 2"
        ("uplevel" body line 1)
        invoked from within
    "uplevel 1 ::gdb_tcl_unknown $args"
        (procedure "::unknown" line 5)
        invoked from within
    "_csi_P 2"
        ("eval" body line 1)
        invoked from within
    "eval _csi_$cmd $params"

It looks like GDB is emitting a CSI that it did not emit before, the
"Delete character" one:

  https://vt100.net/docs/vt510-rm/DCH.html

Implement it.

When I added the _csi_P but without an actual implementation, I stopped
seeing the error shown above, but I had a FAIL.  After adding the
implementation, the test started passing.

Note that I did not investigate why GDB was suddenly emitting this CSI,
if it makes sense, or if I'm just papering over the problem.

Change-Id: I5bf86b6104d51b0623a26a69df83d1ca9a4851b7
---
 gdb/testsuite/lib/tuiterm.exp | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp
index 38948015e96..94bb2703889 100644
--- a/gdb/testsuite/lib/tuiterm.exp
+++ b/gdb/testsuite/lib/tuiterm.exp
@@ -349,6 +349,36 @@ namespace eval Term {
 	}
     }
 
+    # Delete character.
+    #
+    # 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_row
+	    variable _cur_col
+	    variable _chars
+	    variable _cols
+
+	    set y $_cur_row
+
+	    # Move all characters right of the cursor COUNT positions left.
+	    for {set x $_cur_col} {$x < $_cols} {incr x} {
+		set from_x [expr $x + $count]
+
+		if { $from_x < $_cols } {
+		    set c $_chars($from_x,$y)
+		} else {
+		    # Insert blank spaces from the right margin.
+		    set c " "
+		}
+
+		set _chars($x,$y) $c
+	    }
+	}
+    }
+
     # Erase chars.
     #
     # https://vt100.net/docs/vt510-rm/ECH.html
-- 
2.35.1


             reply	other threads:[~2022-03-30  1:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-30  1:24 Simon Marchi [this message]
2022-03-30  9:04 ` Andrew Burgess
2022-03-30 16:58   ` Simon Marchi

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=20220330012411.2993199-1-simon.marchi@efficios.com \
    --to=simon.marchi@efficios.com \
    --cc=gdb-patches@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).