[PATCH 1/2] gdb/testsuite: add links for handled control sequences in lib/tuiterm.exp

Simon Marchi simon.marchi@polymtl.ca
Fri Jan 8 05:30:17 GMT 2021


This code can be a bit cryptic for those who don't know terminal control
sequences very well.  This patch adds links for all the handled
sequences, so it's easy to get some doc to follow the code.

I linked to a VT510 manual, because I think it's well formatted and easy
to read.  There's only the repeat sequence (_csi_b) which I haven't
found in it, it looks to be xterm-specific or something.

I also tried to use the sequence names as they are in the manual.

gdb/testsuite/ChangeLog:

	* lib/tuiterm.exp: Add links in comments.

Change-Id: I670b947a238e5e9bcab7c476a20eb3c31cf2909d
---
 gdb/testsuite/lib/tuiterm.exp | 54 +++++++++++++++++++++++++++++------
 1 file changed, 45 insertions(+), 9 deletions(-)

diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp
index 749212449302..c2a547214bd5 100644
--- a/gdb/testsuite/lib/tuiterm.exp
+++ b/gdb/testsuite/lib/tuiterm.exp
@@ -123,7 +123,9 @@ namespace eval Term {
 	set _cur_x 0
     }
 
-    # Make room for characters.
+    # Insert Character.
+    #
+    # https://vt100.net/docs/vt510-rm/ICH.html
     proc _csi_@ {args} {
 	set n [_default [lindex $args 0] 1]
 	variable _cur_x
@@ -139,6 +141,8 @@ namespace eval Term {
     }
 
     # Cursor Up.
+    #
+    # https://vt100.net/docs/vt510-rm/CUU.html
     proc _csi_A {args} {
 	variable _cur_y
 	set arg [_default [lindex $args 0] 1]
@@ -146,6 +150,8 @@ namespace eval Term {
     }
 
     # Cursor Down.
+    #
+    # https://vt100.net/docs/vt510-rm/CUD.html
     proc _csi_B {args} {
 	variable _cur_y
 	variable _rows
@@ -154,6 +160,8 @@ namespace eval Term {
     }
 
     # Cursor Forward.
+    #
+    # https://vt100.net/docs/vt510-rm/CUF.html
     proc _csi_C {args} {
 	variable _cur_x
 	variable _cols
@@ -161,7 +169,9 @@ namespace eval Term {
 	set _cur_x [expr {min ($_cur_x + $arg, $_cols)}]
     }
 
-    # Cursor Back.
+    # Cursor Backward.
+    #
+    # https://vt100.net/docs/vt510-rm/CUB.html
     proc _csi_D {args} {
 	variable _cur_x
 	set arg [_default [lindex $args 0] 1]
@@ -169,6 +179,8 @@ namespace eval Term {
     }
 
     # Cursor Next Line.
+    #
+    # https://vt100.net/docs/vt510-rm/CNL.html
     proc _csi_E {args} {
 	variable _cur_x
 	variable _cur_y
@@ -179,6 +191,8 @@ namespace eval Term {
     }
 
     # Cursor Previous Line.
+    #
+    # https://vt100.net/docs/vt510-rm/CPL.html
     proc _csi_F {args} {
 	variable _cur_x
 	variable _cur_y
@@ -189,6 +203,8 @@ namespace eval Term {
     }
 
     # Cursor Horizontal Absolute.
+    #
+    # https://vt100.net/docs/vt510-rm/CHA.html
     proc _csi_G {args} {
 	variable _cur_x
 	variable _cols
@@ -196,7 +212,9 @@ namespace eval Term {
 	set _cur_x [expr {min ($arg - 1, $_cols)}]
     }
 
-    # Move cursor (don't know the official name of this one).
+    # Cursor Position.
+    #
+    # https://vt100.net/docs/vt510-rm/CUP.html
     proc _csi_H {args} {
 	variable _cur_x
 	variable _cur_y
@@ -204,7 +222,9 @@ namespace eval Term {
 	set _cur_x [expr {[_default [lindex $args 1] 1] - 1}]
     }
 
-    # Cursor Forward Tabulation.
+    # Cursor Horizontal Forward Tabulation.
+    #
+    # https://vt100.net/docs/vt510-rm/CHT.html
     proc _csi_I {args} {
 	set n [_default [lindex $args 0] 1]
 	variable _cur_x
@@ -215,7 +235,9 @@ namespace eval Term {
 	}
     }
 
-    # Erase.
+    # Erase in Display.
+    #
+    # https://vt100.net/docs/vt510-rm/ED.html
     proc _csi_J {args} {
 	variable _cur_x
 	variable _cur_y
@@ -233,7 +255,9 @@ namespace eval Term {
 	}
     }
 
-    # Erase Line.
+    # Erase in Line.
+    #
+    # https://vt100.net/docs/vt510-rm/EL.html
     proc _csi_K {args} {
 	variable _cur_x
 	variable _cur_y
@@ -249,7 +273,9 @@ namespace eval Term {
 	}
     }
 
-    # Delete lines.
+    # Delete line.
+    #
+    # https://vt100.net/docs/vt510-rm/DL.html
     proc _csi_M {args} {
 	variable _cur_y
 	variable _rows
@@ -270,6 +296,8 @@ namespace eval Term {
     }
 
     # Erase chars.
+    #
+    # https://vt100.net/docs/vt510-rm/ECH.html
     proc _csi_X {args} {
 	set n [_default [lindex $args 0] 1]
 	# Erase characters but don't move cursor.
@@ -285,7 +313,9 @@ namespace eval Term {
 	}
     }
 
-    # Backward tab stops.
+    # Cursor Backward Tabulation.
+    #
+    # https://vt100.net/docs/vt510-rm/CBT.html
     proc _csi_Z {args} {
 	set n [_default [lindex $args 0] 1]
 	variable _cur_x
@@ -293,19 +323,25 @@ namespace eval Term {
     }
 
     # Repeat.
+    #
+    # https://www.xfree86.org/current/ctlseqs.html (See `(REP)`)
     proc _csi_b {args} {
 	variable _last_char
 	set n [_default [lindex $args 0] 1]
 	_insert [string repeat $_last_char $n]
     }
 
-    # Line Position Absolute.
+    # Vertical Line Position Absolute.
+    #
+    # https://vt100.net/docs/vt510-rm/VPA.html
     proc _csi_d {args} {
 	variable _cur_y
 	set _cur_y [expr {[_default [lindex $args 0] 1] - 1}]
     }
 
     # Select Graphic Rendition.
+    #
+    # https://vt100.net/docs/vt510-rm/SGR.html
     proc _csi_m {args} {
 	variable _attrs
 	foreach item $args {
-- 
2.29.2



More information about the Gdb-patches mailing list