]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Fix Term::_csi_m with no args
authorTom de Vries <tdevries@suse.de>
Wed, 23 Jul 2025 20:14:58 +0000 (22:14 +0200)
committerTom de Vries <tdevries@suse.de>
Wed, 23 Jul 2025 20:14:58 +0000 (22:14 +0200)
When calling Term::_csi_m with no args, default behaviour needs to be applied,
which is equivalent to "Term::_csi_m 0" [1].

However, while "Term::_csi_m 0" works, as well as 'Term::_csi_m ""', calling
Term::_csi_m with no args has no effect.

Fix this by implementing the default behaviour in Term::_csi_m.

Tested on aarch64-linux.

Approved-By: Tom Tromey <tom@tromey.com>
[1] https://vt100.net/docs/vt510-rm/SGR.html

gdb/testsuite/gdb.tui/tuiterm.exp
gdb/testsuite/lib/tuiterm.exp

index e58de688ef29e9866b511915d131b909d8d55890..6cd65f3ede7d8573e1fb9bc2319bc25245d628dc 100644 (file)
@@ -783,6 +783,15 @@ proc test_attrs {} {
        set line [Term::get_line_with_attrs 0]
        gdb_assert { [regexp $re $line] } "attribute: $attr"
     }
+
+    # Regression test: Check that _csi_m works without arguments.
+    setup_terminal 4 1
+    Term::_csi_m 7
+    Term::_insert "a"
+    Term::_csi_m
+    Term::_insert "a"
+    set line [Term::get_line_with_attrs 0]
+    gdb_assert { [string equal $line "<reverse:1>a<reverse:0>a  "] }
 }
 
 # Run proc TEST_PROC_NAME with a "small" terminal.
index d4ba1ae11b6b19c13f5bda09851c2c9152e974a3..9ca8334d4376ad2dc3e6e36ffa7af14554eeb5bc 100644 (file)
@@ -631,6 +631,11 @@ namespace eval Term {
     #
     # https://vt100.net/docs/vt510-rm/SGR.html
     proc _csi_m {args} {
+       if { [llength $args] == 0 } {
+           # Apply default.
+           set args [list 0]
+       }
+
        _log_cur "Select Graphic Rendition ([join $args {, }])" {
            variable _attrs