} 0 1
}
+proc test_pan_down { } {
+ Term::_move_cursor 1 2
+ Term::_csi_S
+ check "pan down, default arg" {
+ "ijklmnop"
+ "qrstuvwx"
+ "yz01234 "
+ " "
+ } 1 2
+
+ Term::_csi_S 2
+ check "pan down, explicit arg" {
+ "yz01234 "
+ " "
+ " "
+ " "
+ } 1 2
+
+ Term::_csi_S 100
+ check "pan down, excessive arg" {
+ " "
+ " "
+ " "
+ " "
+ } 1 2
+}
+
+proc test_pan_up { } {
+ Term::_move_cursor 1 2
+ Term::_csi_T
+ check "pan down, default arg" {
+ " "
+ "abcdefgh"
+ "ijklmnop"
+ "qrstuvwx"
+ } 1 2
+
+ Term::_csi_T 2
+ check "pan down, explicit arg" {
+ " "
+ " "
+ " "
+ "abcdefgh"
+ } 1 2
+
+ Term::_csi_T 100
+ check "pan down, excessive arg" {
+ " "
+ " "
+ " "
+ " "
+ } 1 2
+}
+
proc test_cursor_up { } {
Term::_move_cursor 2 3
} 2 3
}
+proc test_insert_line { } {
+ Term::_move_cursor 2 1
+ Term::_csi_L
+ check "insert line, default param" {
+ "abcdefgh"
+ " "
+ "ijklmnop"
+ "qrstuvwx"
+ } 2 1
+
+ Term::_move_cursor 2 0
+ Term::_csi_L 2
+ check "insert line, explicit param" {
+ " "
+ " "
+ "abcdefgh"
+ " "
+ } 2 0
+
+ Term::_csi_L 12
+ check "insert line, insert more lines than display has" {
+ " "
+ " "
+ " "
+ " "
+ } 2 0
+}
+
# Run proc TEST_PROC_NAME with a "small" terminal.
proc run_one_test_small { test_proc_name } {
test_erase_character
test_repeat
test_vertical_line_position_absolute
+ test_insert_line
+ test_pan_up
+ test_pan_down
} {
run_one_test_small $test
}
}
}
+ # Insert Line
+ #
+ # https://vt100.net/docs/vt510-rm/IL.html
+ proc _csi_L {args} {
+ set arg [_default [lindex $args 0] 1]
+
+ _log_cur "Insert Line ($arg)" {
+ variable _cur_col
+ variable _cur_row
+ variable _rows
+ variable _cols
+ variable _chars
+
+ set y [expr $_rows - 2]
+ set next_y [expr $y + $arg]
+ while {$y >= $_cur_row} {
+ for {set x 0} {$x < $_cols} {incr x} {
+ set _chars($x,$next_y) $_chars($x,$y)
+ }
+ incr y -1
+ incr next_y -1
+ }
+
+ _clear_lines $_cur_row [expr $_cur_row + $arg]
+ }
+ }
+
# Delete line.
#
# https://vt100.net/docs/vt510-rm/DL.html
}
}
+ # Pan Down
+ #
+ # https://vt100.net/docs/vt510-rm/SU.html
+ proc _csi_S {args} {
+ set count [_default [lindex $args 0] 1]
+
+ _log_cur "Pan Down ($count)" {
+ variable _cur_col
+ variable _cur_row
+ variable _cols
+ variable _rows
+ variable _chars
+
+ # The following code is written without consideration for
+ # the scroll margins. At this time this comment was
+ # written the tuiterm library doesn't support the scroll
+ # margins. If/when that changes, then the following will
+ # need to be updated.
+
+ set dy 0
+ set y $count
+
+ while {$y < $_rows} {
+ for {set x 0} {$x < $_cols} {incr x} {
+ set _chars($x,$dy) $_chars($x,$y)
+ }
+ incr y 1
+ incr dy 1
+ }
+
+ _clear_lines $dy $_rows
+ }
+ }
+
+ # Pan Up
+ #
+ # https://vt100.net/docs/vt510-rm/SD.html
+ proc _csi_T {args} {
+ set count [_default [lindex $args 0] 1]
+
+ _log_cur "Pan Up ($count)" {
+ variable _cur_col
+ variable _cur_row
+ variable _cols
+ variable _rows
+ variable _chars
+
+ # The following code is written without consideration for
+ # the scroll margins. At this time this comment was
+ # written the tuiterm library doesn't support the scroll
+ # margins. If/when that changes, then the following will
+ # need to be updated.
+
+ set y [expr $_rows - $count]
+ set dy $_rows
+
+ while {$dy >= $count} {
+ for {set x 0} {$x < $_cols} {incr x} {
+ set _chars($x,$dy) $_chars($x,$y)
+ }
+ incr y -1
+ incr dy -1
+ }
+
+ _clear_lines 0 $count
+ }
+ }
+
# Erase chars.
#
# https://vt100.net/docs/vt510-rm/ECH.html