public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb/testsuite/tui: implement _csi_P proc
@ 2022-03-30  1:24 Simon Marchi
  2022-03-30  9:04 ` Andrew Burgess
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2022-03-30  1:24 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-30 16:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-30  1:24 [PATCH] gdb/testsuite/tui: implement _csi_P proc Simon Marchi
2022-03-30  9:04 ` Andrew Burgess
2022-03-30 16:58   ` Simon Marchi

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).