aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2023-05-22 11:38:08 +0200
committerTom de Vries <tdevries@suse.de>2023-05-22 11:38:08 +0200
commita01399ff21e35422868c3853a31811c301a73883 (patch)
treef19ac473d91292838bcf5f1d4b99aae618eafff9
parentbc227f4ccb0778a56ca3d9f27652fd9e5e2747ea (diff)
downloadfsf-binutils-gdb-a01399ff21e35422868c3853a31811c301a73883.zip
fsf-binutils-gdb-a01399ff21e35422868c3853a31811c301a73883.tar.gz
fsf-binutils-gdb-a01399ff21e35422868c3853a31811c301a73883.tar.bz2
[gdb/testsuite] Factor out Term::_reset_attrs
Factor out new proc Term::_reset_attrs. Tested by re-running the TUI test-cases (gdb.tui/*.exp and gdb.python/tui*.exp) on x86_64-linux.
-rw-r--r--gdb/testsuite/lib/tuiterm.exp26
1 files changed, 14 insertions, 12 deletions
diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp
index 64a883e..361fce8 100644
--- a/gdb/testsuite/lib/tuiterm.exp
+++ b/gdb/testsuite/lib/tuiterm.exp
@@ -547,6 +547,18 @@ namespace eval Term {
}
}
+ # Reset the attributes in attributes array UPVAR_NAME to the default values.
+ proc _reset_attrs { upvar_name } {
+ upvar $upvar_name var
+ array set var {
+ intensity normal
+ fg default
+ bg default
+ underline 0
+ reverse 0
+ }
+ }
+
# Select Graphic Rendition.
#
# https://vt100.net/docs/vt510-rm/SGR.html
@@ -557,11 +569,7 @@ namespace eval Term {
foreach item $args {
switch -exact -- $item {
"" - 0 {
- set _attrs(intensity) normal
- set _attrs(fg) default
- set _attrs(bg) default
- set _attrs(underline) 0
- set _attrs(reverse) 0
+ _reset_attrs _attrs
}
1 {
set _attrs(intensity) bold
@@ -666,13 +674,7 @@ namespace eval Term {
set _cur_col 0
set _cur_row 0
set _resize_count 0
- array set _attrs {
- intensity normal
- fg default
- bg default
- underline 0
- reverse 0
- }
+ _reset_attrs _attrs
_clear_lines 0 $_rows
}