gdb/testsuite: add links for handled control sequences in lib/tuiterm.exp

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
This commit is contained in:
Simon Marchi
2021-01-20 16:09:31 -05:00
parent 7c794afd54
commit 6571ffc620
2 changed files with 49 additions and 9 deletions

View File

@ -1,3 +1,7 @@
2021-01-20 Simon Marchi <simon.marchi@polymtl.ca>
* lib/tuiterm.exp: Add links in comments.
2021-01-20 Tom de Vries <tdevries@suse.de> 2021-01-20 Tom de Vries <tdevries@suse.de>
* gdb.python/py-format-string.exp: Allow Deriv+$decimal as vtable * gdb.python/py-format-string.exp: Allow Deriv+$decimal as vtable

View File

@ -123,7 +123,9 @@ namespace eval Term {
set _cur_x 0 set _cur_x 0
} }
# Make room for characters. # Insert Character.
#
# https://vt100.net/docs/vt510-rm/ICH.html
proc _csi_@ {args} { proc _csi_@ {args} {
set n [_default [lindex $args 0] 1] set n [_default [lindex $args 0] 1]
variable _cur_x variable _cur_x
@ -139,6 +141,8 @@ namespace eval Term {
} }
# Cursor Up. # Cursor Up.
#
# https://vt100.net/docs/vt510-rm/CUU.html
proc _csi_A {args} { proc _csi_A {args} {
variable _cur_y variable _cur_y
set arg [_default [lindex $args 0] 1] set arg [_default [lindex $args 0] 1]
@ -146,6 +150,8 @@ namespace eval Term {
} }
# Cursor Down. # Cursor Down.
#
# https://vt100.net/docs/vt510-rm/CUD.html
proc _csi_B {args} { proc _csi_B {args} {
variable _cur_y variable _cur_y
variable _rows variable _rows
@ -154,6 +160,8 @@ namespace eval Term {
} }
# Cursor Forward. # Cursor Forward.
#
# https://vt100.net/docs/vt510-rm/CUF.html
proc _csi_C {args} { proc _csi_C {args} {
variable _cur_x variable _cur_x
variable _cols variable _cols
@ -161,7 +169,9 @@ namespace eval Term {
set _cur_x [expr {min ($_cur_x + $arg, $_cols)}] 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} { proc _csi_D {args} {
variable _cur_x variable _cur_x
set arg [_default [lindex $args 0] 1] set arg [_default [lindex $args 0] 1]
@ -169,6 +179,8 @@ namespace eval Term {
} }
# Cursor Next Line. # Cursor Next Line.
#
# https://vt100.net/docs/vt510-rm/CNL.html
proc _csi_E {args} { proc _csi_E {args} {
variable _cur_x variable _cur_x
variable _cur_y variable _cur_y
@ -179,6 +191,8 @@ namespace eval Term {
} }
# Cursor Previous Line. # Cursor Previous Line.
#
# https://vt100.net/docs/vt510-rm/CPL.html
proc _csi_F {args} { proc _csi_F {args} {
variable _cur_x variable _cur_x
variable _cur_y variable _cur_y
@ -189,6 +203,8 @@ namespace eval Term {
} }
# Cursor Horizontal Absolute. # Cursor Horizontal Absolute.
#
# https://vt100.net/docs/vt510-rm/CHA.html
proc _csi_G {args} { proc _csi_G {args} {
variable _cur_x variable _cur_x
variable _cols variable _cols
@ -196,7 +212,9 @@ namespace eval Term {
set _cur_x [expr {min ($arg - 1, $_cols)}] 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} { proc _csi_H {args} {
variable _cur_x variable _cur_x
variable _cur_y variable _cur_y
@ -204,7 +222,9 @@ namespace eval Term {
set _cur_x [expr {[_default [lindex $args 1] 1] - 1}] 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} { proc _csi_I {args} {
set n [_default [lindex $args 0] 1] set n [_default [lindex $args 0] 1]
variable _cur_x 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} { proc _csi_J {args} {
variable _cur_x variable _cur_x
variable _cur_y 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} { proc _csi_K {args} {
variable _cur_x variable _cur_x
variable _cur_y 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} { proc _csi_M {args} {
variable _cur_y variable _cur_y
variable _rows variable _rows
@ -270,6 +296,8 @@ namespace eval Term {
} }
# Erase chars. # Erase chars.
#
# https://vt100.net/docs/vt510-rm/ECH.html
proc _csi_X {args} { proc _csi_X {args} {
set n [_default [lindex $args 0] 1] set n [_default [lindex $args 0] 1]
# Erase characters but don't move cursor. # 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} { proc _csi_Z {args} {
set n [_default [lindex $args 0] 1] set n [_default [lindex $args 0] 1]
variable _cur_x variable _cur_x
@ -293,19 +323,25 @@ namespace eval Term {
} }
# Repeat. # Repeat.
#
# https://www.xfree86.org/current/ctlseqs.html (See `(REP)`)
proc _csi_b {args} { proc _csi_b {args} {
variable _last_char variable _last_char
set n [_default [lindex $args 0] 1] set n [_default [lindex $args 0] 1]
_insert [string repeat $_last_char $n] _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} { proc _csi_d {args} {
variable _cur_y variable _cur_y
set _cur_y [expr {[_default [lindex $args 0] 1] - 1}] set _cur_y [expr {[_default [lindex $args 0] 1] - 1}]
} }
# Select Graphic Rendition. # Select Graphic Rendition.
#
# https://vt100.net/docs/vt510-rm/SGR.html
proc _csi_m {args} { proc _csi_m {args} {
variable _attrs variable _attrs
foreach item $args { foreach item $args {