From 6a82917ae30bfb9b778644a6b19d8d79ab04a068 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Wed, 23 Jul 2025 22:14:58 +0200 Subject: [PATCH] [gdb/testsuite] Fix Term::_csi_m with no args 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 [1] https://vt100.net/docs/vt510-rm/SGR.html --- gdb/testsuite/gdb.tui/tuiterm.exp | 9 +++++++++ gdb/testsuite/lib/tuiterm.exp | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/gdb/testsuite/gdb.tui/tuiterm.exp b/gdb/testsuite/gdb.tui/tuiterm.exp index e58de688ef2..6cd65f3ede7 100644 --- a/gdb/testsuite/gdb.tui/tuiterm.exp +++ b/gdb/testsuite/gdb.tui/tuiterm.exp @@ -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 "aa "] } } # Run proc TEST_PROC_NAME with a "small" terminal. diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp index d4ba1ae11b6..9ca8334d437 100644 --- a/gdb/testsuite/lib/tuiterm.exp +++ b/gdb/testsuite/lib/tuiterm.exp @@ -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 -- 2.47.2