|
|
@ -1526,7 +1526,8 @@ proc overtype::renderline {args} { |
|
|
|
# that non-sgr codes are not that common, so ok to check for resets before verifying it is actually SGR at all. |
|
|
|
# that non-sgr codes are not that common, so ok to check for resets before verifying it is actually SGR at all. |
|
|
|
if {$code ne ""} { |
|
|
|
if {$code ne ""} { |
|
|
|
if {[punk::ansi::codetype::is_sgr_reset $code]} { |
|
|
|
if {[punk::ansi::codetype::is_sgr_reset $code]} { |
|
|
|
set u_codestack [list] |
|
|
|
#set u_codestack [list] |
|
|
|
|
|
|
|
set u_codestack [list "\x1b\[m"] |
|
|
|
} elseif {[punk::ansi::codetype::has_sgr_leadingreset $code]} { |
|
|
|
} elseif {[punk::ansi::codetype::has_sgr_leadingreset $code]} { |
|
|
|
set u_codestack [list $code] |
|
|
|
set u_codestack [list $code] |
|
|
|
} elseif {[punk::ansi::codetype::is_sgr $code]} { |
|
|
|
} elseif {[punk::ansi::codetype::is_sgr $code]} { |
|
|
@ -1672,7 +1673,7 @@ proc overtype::renderline {args} { |
|
|
|
lappend overlay_grapheme_control_stacks $o_codestack |
|
|
|
lappend overlay_grapheme_control_stacks $o_codestack |
|
|
|
#there will always be an empty code at end due to foreach on 2 vars with odd-sized list ending with pt (overmap coming from perlish split) |
|
|
|
#there will always be an empty code at end due to foreach on 2 vars with odd-sized list ending with pt (overmap coming from perlish split) |
|
|
|
if {[punk::ansi::codetype::is_sgr_reset $code]} { |
|
|
|
if {[punk::ansi::codetype::is_sgr_reset $code]} { |
|
|
|
set o_codestack [list] |
|
|
|
set o_codestack [list "\x1b\[m"] ;#reset better than empty list - fixes some ansi art issues |
|
|
|
lappend overlay_grapheme_control_list [list sgr $code] |
|
|
|
lappend overlay_grapheme_control_list [list sgr $code] |
|
|
|
} elseif {[punk::ansi::codetype::has_sgr_leadingreset $code]} { |
|
|
|
} elseif {[punk::ansi::codetype::has_sgr_leadingreset $code]} { |
|
|
|
set o_codestack [list $code] |
|
|
|
set o_codestack [list $code] |
|
|
@ -1686,7 +1687,8 @@ proc overtype::renderline {args} { |
|
|
|
} elseif {[regexp {\x1b7|\x1b\[s} $code]} { |
|
|
|
} elseif {[regexp {\x1b7|\x1b\[s} $code]} { |
|
|
|
#experiment |
|
|
|
#experiment |
|
|
|
#cursor_save - for the replays review. |
|
|
|
#cursor_save - for the replays review. |
|
|
|
set temp_cursor_saved [punk::ansi::codetype::sgr_merge_list {*}$o_codestack] |
|
|
|
#jmn |
|
|
|
|
|
|
|
#set temp_cursor_saved [punk::ansi::codetype::sgr_merge_list {*}$o_codestack] |
|
|
|
lappend overlay_grapheme_control_list [list other $code] |
|
|
|
lappend overlay_grapheme_control_list [list other $code] |
|
|
|
} elseif {[regexp {\x1b8|\x1b\[u} $code]} { |
|
|
|
} elseif {[regexp {\x1b8|\x1b\[u} $code]} { |
|
|
|
#experiment |
|
|
|
#experiment |
|
|
@ -2128,10 +2130,11 @@ proc overtype::renderline {args} { |
|
|
|
set re_row_move {\x1b\[([0-9]*)(A|B)$} |
|
|
|
set re_row_move {\x1b\[([0-9]*)(A|B)$} |
|
|
|
set re_both_move {\x1b\[([0-9]*)(?:;){0,1}([0-9]*)H$} ;# or "f" ? |
|
|
|
set re_both_move {\x1b\[([0-9]*)(?:;){0,1}([0-9]*)H$} ;# or "f" ? |
|
|
|
set re_vt_sequence {\x1b\[([0-9]*)(?:;){0,1}([0-9]*)~$} |
|
|
|
set re_vt_sequence {\x1b\[([0-9]*)(?:;){0,1}([0-9]*)~$} |
|
|
|
set re_cursor_save {\x1b\[s$} |
|
|
|
set re_cursor_save {\x1b\[s$} |
|
|
|
set re_cursor_restore {\x1b\[u$} |
|
|
|
set re_cursor_restore {\x1b\[u$} |
|
|
|
set re_cursor_save_dec {\x1b7$} |
|
|
|
set re_cursor_save_dec {\x1b7$} |
|
|
|
set re_cursor_restore_dec {\x1b8$} |
|
|
|
set re_cursor_restore_dec {\x1b8$} |
|
|
|
|
|
|
|
set re_decstbm {\x1b\[([0-9]*)(?:;){0,1}([0-9]*)r$} ;#DECSTBM set top and bottom margins |
|
|
|
set matchinfo [list] |
|
|
|
set matchinfo [list] |
|
|
|
|
|
|
|
|
|
|
|
switch -regexp -matchvar matchinfo -- $code\ |
|
|
|
switch -regexp -matchvar matchinfo -- $code\ |
|
|
@ -2339,6 +2342,22 @@ proc overtype::renderline {args} { |
|
|
|
set instruction move |
|
|
|
set instruction move |
|
|
|
break |
|
|
|
break |
|
|
|
}\ |
|
|
|
}\ |
|
|
|
|
|
|
|
$re_decstbm { |
|
|
|
|
|
|
|
#https://www.vt100.net/docs/vt510-rm/DECSTBM.html |
|
|
|
|
|
|
|
#This control function sets the top and bottom margins for the current page. You cannot perform scrolling outside the margins |
|
|
|
|
|
|
|
lassign $matchinfo _match margin_top margin_bottom |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#todo - return these for the caller to process.. |
|
|
|
|
|
|
|
puts stderr "overtype::renderline DECSTBM set top and bottom margin not implemented" |
|
|
|
|
|
|
|
#Also moves the cursor to col 1 line 1 of the page |
|
|
|
|
|
|
|
set cursor_column 1 |
|
|
|
|
|
|
|
set cursor_row 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
incr idx_over |
|
|
|
|
|
|
|
priv::render_unapplied $overlay_grapheme_control_list $gci |
|
|
|
|
|
|
|
set instruction move ;#own instruction? decstbm? |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
}\ |
|
|
|
$re_vt_sequence { |
|
|
|
$re_vt_sequence { |
|
|
|
lassign $matchinfo _match key mod |
|
|
|
lassign $matchinfo _match key mod |
|
|
|
#Note that f1 to f4 show as ESCOP|Q|R|S (VT220?) but f5+ show as ESC\[15~ |
|
|
|
#Note that f1 to f4 show as ESCOP|Q|R|S (VT220?) but f5+ show as ESC\[15~ |
|
|
@ -2442,7 +2461,8 @@ proc overtype::renderline {args} { |
|
|
|
sgr { |
|
|
|
sgr { |
|
|
|
#code is the raw code |
|
|
|
#code is the raw code |
|
|
|
if {[punk::ansi::codetype::is_sgr_reset $code]} { |
|
|
|
if {[punk::ansi::codetype::is_sgr_reset $code]} { |
|
|
|
set sgr_stack [list] |
|
|
|
#jmn |
|
|
|
|
|
|
|
set sgr_stack [list "\x1b\[m"] |
|
|
|
} elseif {[punk::ansi::codetype::has_sgr_leadingreset $code]} { |
|
|
|
} elseif {[punk::ansi::codetype::has_sgr_leadingreset $code]} { |
|
|
|
set sgr_stack [list $code] |
|
|
|
set sgr_stack [list $code] |
|
|
|
lappend overlay_grapheme_control_list [list sgr $code] |
|
|
|
lappend overlay_grapheme_control_list [list sgr $code] |
|
|
@ -2514,6 +2534,7 @@ proc overtype::renderline {args} { |
|
|
|
break |
|
|
|
break |
|
|
|
}\ |
|
|
|
}\ |
|
|
|
$re_mode { |
|
|
|
$re_mode { |
|
|
|
|
|
|
|
lassign $matchinfo _match num type |
|
|
|
switch -- $num { |
|
|
|
switch -- $num { |
|
|
|
5 { |
|
|
|
5 { |
|
|
|
#DECSNM - reverse video |
|
|
|
#DECSNM - reverse video |
|
|
@ -2551,8 +2572,21 @@ proc overtype::renderline {args} { |
|
|
|
set overflow_idx -1 |
|
|
|
set overflow_idx -1 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
25 { |
|
|
|
|
|
|
|
if {$type eq "h"} { |
|
|
|
|
|
|
|
#visible cursor |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
#invisible cursor |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}\ |
|
|
|
|
|
|
|
default { |
|
|
|
|
|
|
|
#puts stderr "overtype::renderline code [ansistring VIEW -lf 1 -vt 1 -nul 1 $code] not implemented" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
default { |
|
|
|
default { |
|
|
|
#don't need to handle sgr or gx0 types |
|
|
|
#don't need to handle sgr or gx0 types |
|
|
@ -2613,9 +2647,11 @@ proc overtype::renderline {args} { |
|
|
|
set cstack [lindex $understacks $i] |
|
|
|
set cstack [lindex $understacks $i] |
|
|
|
if {$cstack ne $prevstack} { |
|
|
|
if {$cstack ne $prevstack} { |
|
|
|
if {[llength $prevstack] && ![llength $cstack]} { |
|
|
|
if {[llength $prevstack] && ![llength $cstack]} { |
|
|
|
|
|
|
|
#This reset is important e.g testfile fruit.ans - we get overhang on rhs without it. But why is cstack empty? |
|
|
|
append sgrleader \033\[m |
|
|
|
append sgrleader \033\[m |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
append sgrleader [punk::ansi::codetype::sgr_merge_list {*}$cstack] |
|
|
|
} |
|
|
|
} |
|
|
|
append sgrleader [punk::ansi::codetype::sgr_merge_list {*}$cstack] |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
set prevstack $cstack |
|
|
|
set prevstack $cstack |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -2637,9 +2673,9 @@ proc overtype::renderline {args} { |
|
|
|
set cstack [lindex $understacks $i] |
|
|
|
set cstack [lindex $understacks $i] |
|
|
|
set sgrleader "" |
|
|
|
set sgrleader "" |
|
|
|
#whether cstack is same or differs from previous char's stack - we must have an output at the start of the overflow_right |
|
|
|
#whether cstack is same or differs from previous char's stack - we must have an output at the start of the overflow_right |
|
|
|
if {[llength $prevstack] && ![llength $cstack]} { |
|
|
|
#if {[llength $prevstack] && ![llength $cstack]} { |
|
|
|
append sgrleader \033\[m |
|
|
|
# append sgrleader \033\[m |
|
|
|
} |
|
|
|
#} |
|
|
|
append sgrleader [punk::ansi::codetype::sgr_merge_list {*}$cstack] |
|
|
|
append sgrleader [punk::ansi::codetype::sgr_merge_list {*}$cstack] |
|
|
|
append overflow_right $sgrleader |
|
|
|
append overflow_right $sgrleader |
|
|
|
append overflow_right $ch |
|
|
|
append overflow_right $ch |
|
|
|