Browse Source

update bootsupport

master
Julian Noble 1 month ago
parent
commit
1838b61557
  1. 36
      src/bootsupport/modules/punk/ansi-0.1.1.tm
  2. 20
      src/bootsupport/modules/punk/args-0.2.tm
  3. 42
      src/bootsupport/modules/textblock-0.1.3.tm
  4. 36
      src/project_layouts/custom/_project/punk.project-0.1/src/bootsupport/modules/punk/ansi-0.1.1.tm
  5. 20
      src/project_layouts/custom/_project/punk.project-0.1/src/bootsupport/modules/punk/args-0.2.tm
  6. 42
      src/project_layouts/custom/_project/punk.project-0.1/src/bootsupport/modules/textblock-0.1.3.tm
  7. 36
      src/project_layouts/custom/_project/punk.shell-0.1/src/bootsupport/modules/punk/ansi-0.1.1.tm
  8. 20
      src/project_layouts/custom/_project/punk.shell-0.1/src/bootsupport/modules/punk/args-0.2.tm
  9. 42
      src/project_layouts/custom/_project/punk.shell-0.1/src/bootsupport/modules/textblock-0.1.3.tm
  10. 2
      src/vfs/_vfscommon.vfs/lib/icons/icons.tcl
  11. 36
      src/vfs/_vfscommon.vfs/modules/punk/ansi-0.1.1.tm
  12. 20
      src/vfs/_vfscommon.vfs/modules/punk/args-0.2.tm
  13. 4
      src/vfs/_vfscommon.vfs/modules/punk/args/tclcore-0.1.0.tm
  14. 3
      src/vfs/_vfscommon.vfs/modules/punk/repl-0.1.2.tm
  15. 42
      src/vfs/_vfscommon.vfs/modules/textblock-0.1.3.tm

36
src/bootsupport/modules/punk/ansi-0.1.1.tm

@ -3789,6 +3789,7 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
set emit "" set emit ""
#set parts [punk::ansi::ta::split_codes $text] #set parts [punk::ansi::ta::split_codes $text]
set parts [punk::ansi::ta::split_codes_single $text] set parts [punk::ansi::ta::split_codes_single $text]
set prevcode ""
foreach {pt code} $parts { foreach {pt code} $parts {
switch -- [llength $codestack] { switch -- [llength $codestack] {
0 { 0 {
@ -3809,6 +3810,7 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
} }
#parts ends on a pt - last code always empty string #parts ends on a pt - last code always empty string
if {$code ne ""} { if {$code ne ""} {
set prevcode $code
set c1c2 [tcl::string::range $code 0 1] set c1c2 [tcl::string::range $code 0 1]
set leadernorm [tcl::string::range [tcl::string::map [list\ set leadernorm [tcl::string::range [tcl::string::map [list\
\x1b\[ 7CSI\ \x1b\[ 7CSI\
@ -3827,7 +3829,8 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
set codestack [lremove $codestack {*}$dup_posns] set codestack [lremove $codestack {*}$dup_posns]
lappend codestack $code lappend codestack $code
} else { } else {
#jjtest
append emit $code
} }
} }
7GFX { 7GFX {
@ -3839,12 +3842,23 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
set o_gx_state off set o_gx_state off
} }
} }
#jjtest
append emit $code
} }
default { default {
#other ansi codes #other ansi codes
#jjtest
append emit $code
} }
} }
append emit $code #jjtest
#append emit $code
} else {
#jjtest
#code is only empty when processing final pt
if {$pt eq ""} {
append emit $prevcode
}
} }
} }
return [append emit $R] return [append emit $R]
@ -3882,6 +3896,7 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
set emit "" set emit ""
#set parts [punk::ansi::ta::split_codes $text] #set parts [punk::ansi::ta::split_codes $text]
set parts [punk::ansi::ta::split_codes_single $text] set parts [punk::ansi::ta::split_codes_single $text]
set prevcode ""
foreach {pt code} $parts { foreach {pt code} $parts {
switch -- [llength $codestack] { switch -- [llength $codestack] {
0 { 0 {
@ -3902,6 +3917,7 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
} }
#parts ends on a pt - last code always empty string #parts ends on a pt - last code always empty string
if {$code ne ""} { if {$code ne ""} {
set prevcode $code
set c1c2 [tcl::string::range $code 0 1] set c1c2 [tcl::string::range $code 0 1]
set leadernorm [tcl::string::range [tcl::string::map [list\ set leadernorm [tcl::string::range [tcl::string::map [list\
\x1b\[ 7CSI\ \x1b\[ 7CSI\
@ -3920,7 +3936,8 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
set codestack [lremove $codestack {*}$dup_posns] set codestack [lremove $codestack {*}$dup_posns]
lappend codestack $code lappend codestack $code
} else { } else {
#jjtest
apend emit $code
} }
} }
7GFX { 7GFX {
@ -3932,12 +3949,23 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
set o_gx_state off set o_gx_state off
} }
} }
#jjtest
append emit $code
} }
default { default {
#other ansi codes #other ansi codes
#jjtest
append emit $code
} }
} }
append emit $code #jjtest
#append emit $code
} else {
#jjtest
#code is only empty when processing final pt
if {$pt eq ""} {
append emit $prevcode
}
} }
} }
return [append emit $R] return [append emit $R]

20
src/bootsupport/modules/punk/args-0.2.tm

@ -3169,6 +3169,7 @@ tcl::namespace::eval punk::args {
set arg_error_CLR(goodarg) [a+ green strike] set arg_error_CLR(goodarg) [a+ green strike]
set arg_error_CLR(goodchoice) [a+ reverse] set arg_error_CLR(goodchoice) [a+ reverse]
set arg_error_CLR(linebase_header) [a+ white] set arg_error_CLR(linebase_header) [a+ white]
set arg_error_CLR(linebase) [a+ white]
set arg_error_CLR(cmdname) [a+ brightwhite] set arg_error_CLR(cmdname) [a+ brightwhite]
set arg_error_CLR(groupname) [a+ bold] set arg_error_CLR(groupname) [a+ bold]
set arg_error_CLR(ansiborder) [a+ bold] set arg_error_CLR(ansiborder) [a+ bold]
@ -3380,7 +3381,7 @@ tcl::namespace::eval punk::args {
#set RST [a] #set RST [a]
set RST "\x1b\[m" set RST "\x1b\[0m"
set t "" ;#possible oo table object - may be tested for objectiness at the end so needs to exist. set t "" ;#possible oo table object - may be tested for objectiness at the end so needs to exist.
#REVIEW - risk of accidental indefinite recursion if functions used here also use punk::args::get_dict and there is an argument error #REVIEW - risk of accidental indefinite recursion if functions used here also use punk::args::get_dict and there is an argument error
@ -3442,7 +3443,8 @@ tcl::namespace::eval punk::args {
if {$cmdhelp ne ""} { if {$cmdhelp ne ""} {
lappend blank_header_col "" lappend blank_header_col ""
#set cmdhelp_display [a+ brightwhite]$cmdhelp[a] #set cmdhelp_display [a+ brightwhite]$cmdhelp[a]
set cmdhelp_display [textblock::ansibase_lines $cmdhelp $CLR(linebase_header)] #set cmdhelp_display [textblock::ansibase_lines $cmdhelp $CLR(linebase_header)]
set cmdhelp_display [punk::ansi::ansiwrap_raw $CLR(linebase_header) "" "" $cmdhelp]
} else { } else {
set cmdhelp_display "" set cmdhelp_display ""
} }
@ -4040,8 +4042,16 @@ tcl::namespace::eval punk::args {
$obj configure_column $i -blockalign left $obj configure_column $i -blockalign left
incr i incr i
} }
append help \n[textblock::join -- " " [$obj print]] append help \n[textblock::join -- " " [$obj print]]
#-------------
#todo - tests
#see special case double reset at end of content in textblock class table get_column_by_index
#bug fixed - needed to ensure last two resets were actually concurrent and at end.
#append help "\nbase[a+ green]ab\nc[a]base" ;#ok
#vs
#append help "\nbase[a+ green]a[a]b\nc[a]base" ;#not ok
#-------------
#set ansititle [dict get [$obj configure -title] value] #set ansititle [dict get [$obj configure -title] value]
$obj destroy $obj destroy
} }
@ -4239,9 +4249,13 @@ tcl::namespace::eval punk::args {
if {[info object isa object $t]} { if {[info object isa object $t]} {
set result $t set result $t
} }
} else {
#put original error at bottom of table too
append result \n $msg
} }
} else { } else {
set result $errmsg set result $errmsg
append result \n $msg
} }
if {$as_error} { if {$as_error} {
#add PUNK to the tail end of the more usual -errorcode {TCL WRONGARGS} so we maintain reasonable compat with things looking for TCL WRONGARGS - but also differentiate it. #add PUNK to the tail end of the more usual -errorcode {TCL WRONGARGS} so we maintain reasonable compat with things looking for TCL WRONGARGS - but also differentiate it.

42
src/bootsupport/modules/textblock-0.1.3.tm

@ -2534,24 +2534,26 @@ tcl::namespace::eval textblock {
set parts [punk::ansi::ta::split_codes_single $c] set parts [punk::ansi::ta::split_codes_single $c]
#we have detected ansi - so there will always be at least 3 parts beginning and ending with pt pt,ansi,pt,ansi...,pt #we have detected ansi - so there will always be at least 3 parts beginning and ending with pt pt,ansi,pt,ansi...,pt
set codes [list] set codes [list]
set ptlens [list]
foreach {pt cd} $parts { foreach {pt cd} $parts {
if {$cd ne ""} {
lappend codes $cd lappend codes $cd
} lappend ptlens [string length $pt]
} }
#set takebg [lindex $parts end-1] #set takebg [lindex $parts end-1]
#set cell_bg [punk::ansi::codetype::sgr_merge_singles [list $takebg] -filter_fg 1] #set cell_bg [punk::ansi::codetype::sgr_merge_singles [list $takebg] -filter_fg 1]
set cell_bg [punk::ansi::codetype::sgr_merge_singles $codes -filter_fg 1 -filter_reset 1] set cell_bg [punk::ansi::codetype::sgr_merge_singles $codes -filter_fg 1 -filter_reset 1]
#puts --->[ansistring VIEW $codes] #puts --->[ansistring VIEW $codes]
if {[punk::ansi::codetype::is_sgr_reset [lindex $codes end]]} {
if {[punk::ansi::codetype::is_sgr_reset [lindex $codes end-1]]} { if {[punk::ansi::codetype::is_sgr_reset [lindex $codes end-1]]} {
if {[lindex $ptlens end] == 0 && [lindex $ptlens end-1] == 0 && [punk::ansi::codetype::is_sgr_reset [lindex $codes end-2]]} {
#special case double reset at end of content #special case double reset at end of content
set cell_ansi_tail [punk::ansi::codetype::sgr_merge_singles $codes] ;#no filters #TODO - write test!
set cell_ansi_tail [punk::ansi::codetype::sgr_merge_singles [lrange $codes 0 end-3]] ;#no filters
set ansibase "" set ansibase ""
set row_ansibase "" set row_ansibase ""
if {$ftblock} { if {$ftblock} {
set ansiborder_final [punk::ansi::codetype::sgr_merge [list $ansiborder_body_col_row] -filter_bg 1] set ansiborder_final [punk::ansi::codetype::sgr_merge [list $ansiborder_body_col_row] -filter_bg 1]
set ansiborder_final [punk::ansi::codetype::sgr_merge [list $ansiborder_final $cell_bg]]
} }
set cell_ansibase $cell_ansi_tail set cell_ansibase $cell_ansi_tail
} else { } else {
@ -2565,6 +2567,28 @@ tcl::namespace::eval textblock {
} }
set cell_ansibase $cell_bg set cell_ansibase $cell_bg
} }
#v1
#if {[punk::ansi::codetype::is_sgr_reset [lindex $codes end]]} {
# if {[punk::ansi::codetype::is_sgr_reset [lindex $codes end-1]]} {
# #special case double reset at end of content
# set cell_ansi_tail [punk::ansi::codetype::sgr_merge_singles $codes] ;#no filters
# set ansibase ""
# set row_ansibase ""
# if {$ftblock} {
# set ansiborder_final [punk::ansi::codetype::sgr_merge [list $ansiborder_body_col_row] -filter_bg 1]
# }
# set cell_ansibase $cell_ansi_tail
# } else {
# #single trailing reset in content
# set cell_ansibase "" ;#cell doesn't contribute to frame's ansibase
# }
#} else {
# if {$ftblock} {
# #no resets - use cell's bg to extend to the border - only for block frames
# set ansiborder_final $ansiborder_body_col_row$cell_bg
# }
# set cell_ansibase $cell_bg
#}
} }
set ansibase_final $ansibase$row_ansibase$cell_ansibase set ansibase_final $ansibase$row_ansibase$cell_ansibase
@ -8629,8 +8653,11 @@ tcl::namespace::eval textblock {
if {$opt_ansibase ne ""} { if {$opt_ansibase ne ""} {
if {[punk::ansi::ta::detect $cache_inner]} { if {[punk::ansi::ta::detect $cache_inner]} {
#set cache_inner [punk::ansi::ansiwrap -rawansi $opt_ansibase $cache_inner] #set cache_inner [punk::ansi::ansiwrap -rawansi $opt_ansibase $cache_inner]
set cache_inner [punk::ansi::ansiwrap_raw $opt_ansibase "" "" $cache_inner] #set cache_inner [punk::ansi::ansiwrap_raw $opt_ansibase "" "" $cache_inner]
#jjj ??? review
set cache_inner [punk::ansi::ansiwrap_raw $opt_ansibase "\x1b\[m" "" $cache_inner]
} else { } else {
#!!!
set cache_inner "$opt_ansibase$cache_inner\x1b\[0m" set cache_inner "$opt_ansibase$cache_inner\x1b\[0m"
} }
} }
@ -8723,7 +8750,10 @@ tcl::namespace::eval textblock {
if {$opt_ansibase ne ""} { if {$opt_ansibase ne ""} {
if {$contents_has_ansi} { if {$contents_has_ansi} {
#set contents [punk::ansi::ansiwrap -rawansi $opt_ansibase $contents] #set contents [punk::ansi::ansiwrap -rawansi $opt_ansibase $contents]
set contents [punk::ansi::ansiwrap_raw $opt_ansibase "" "" $contents] #set contents [punk::ansi::ansiwrap_raw $opt_ansibase "" "" $contents]
#jjj
set contents [punk::ansi::ansiwrap_raw $opt_ansibase "\x1b\[m" "" $contents]
#set contents "$opt_ansibase$contents\x1b\[0m"
} else { } else {
set contents "$opt_ansibase$contents\x1b\[0m" set contents "$opt_ansibase$contents\x1b\[0m"
set contents_has_ansi 1 set contents_has_ansi 1

36
src/project_layouts/custom/_project/punk.project-0.1/src/bootsupport/modules/punk/ansi-0.1.1.tm

@ -3789,6 +3789,7 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
set emit "" set emit ""
#set parts [punk::ansi::ta::split_codes $text] #set parts [punk::ansi::ta::split_codes $text]
set parts [punk::ansi::ta::split_codes_single $text] set parts [punk::ansi::ta::split_codes_single $text]
set prevcode ""
foreach {pt code} $parts { foreach {pt code} $parts {
switch -- [llength $codestack] { switch -- [llength $codestack] {
0 { 0 {
@ -3809,6 +3810,7 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
} }
#parts ends on a pt - last code always empty string #parts ends on a pt - last code always empty string
if {$code ne ""} { if {$code ne ""} {
set prevcode $code
set c1c2 [tcl::string::range $code 0 1] set c1c2 [tcl::string::range $code 0 1]
set leadernorm [tcl::string::range [tcl::string::map [list\ set leadernorm [tcl::string::range [tcl::string::map [list\
\x1b\[ 7CSI\ \x1b\[ 7CSI\
@ -3827,7 +3829,8 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
set codestack [lremove $codestack {*}$dup_posns] set codestack [lremove $codestack {*}$dup_posns]
lappend codestack $code lappend codestack $code
} else { } else {
#jjtest
append emit $code
} }
} }
7GFX { 7GFX {
@ -3839,12 +3842,23 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
set o_gx_state off set o_gx_state off
} }
} }
#jjtest
append emit $code
} }
default { default {
#other ansi codes #other ansi codes
#jjtest
append emit $code
} }
} }
append emit $code #jjtest
#append emit $code
} else {
#jjtest
#code is only empty when processing final pt
if {$pt eq ""} {
append emit $prevcode
}
} }
} }
return [append emit $R] return [append emit $R]
@ -3882,6 +3896,7 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
set emit "" set emit ""
#set parts [punk::ansi::ta::split_codes $text] #set parts [punk::ansi::ta::split_codes $text]
set parts [punk::ansi::ta::split_codes_single $text] set parts [punk::ansi::ta::split_codes_single $text]
set prevcode ""
foreach {pt code} $parts { foreach {pt code} $parts {
switch -- [llength $codestack] { switch -- [llength $codestack] {
0 { 0 {
@ -3902,6 +3917,7 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
} }
#parts ends on a pt - last code always empty string #parts ends on a pt - last code always empty string
if {$code ne ""} { if {$code ne ""} {
set prevcode $code
set c1c2 [tcl::string::range $code 0 1] set c1c2 [tcl::string::range $code 0 1]
set leadernorm [tcl::string::range [tcl::string::map [list\ set leadernorm [tcl::string::range [tcl::string::map [list\
\x1b\[ 7CSI\ \x1b\[ 7CSI\
@ -3920,7 +3936,8 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
set codestack [lremove $codestack {*}$dup_posns] set codestack [lremove $codestack {*}$dup_posns]
lappend codestack $code lappend codestack $code
} else { } else {
#jjtest
apend emit $code
} }
} }
7GFX { 7GFX {
@ -3932,12 +3949,23 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
set o_gx_state off set o_gx_state off
} }
} }
#jjtest
append emit $code
} }
default { default {
#other ansi codes #other ansi codes
#jjtest
append emit $code
} }
} }
append emit $code #jjtest
#append emit $code
} else {
#jjtest
#code is only empty when processing final pt
if {$pt eq ""} {
append emit $prevcode
}
} }
} }
return [append emit $R] return [append emit $R]

20
src/project_layouts/custom/_project/punk.project-0.1/src/bootsupport/modules/punk/args-0.2.tm

@ -3169,6 +3169,7 @@ tcl::namespace::eval punk::args {
set arg_error_CLR(goodarg) [a+ green strike] set arg_error_CLR(goodarg) [a+ green strike]
set arg_error_CLR(goodchoice) [a+ reverse] set arg_error_CLR(goodchoice) [a+ reverse]
set arg_error_CLR(linebase_header) [a+ white] set arg_error_CLR(linebase_header) [a+ white]
set arg_error_CLR(linebase) [a+ white]
set arg_error_CLR(cmdname) [a+ brightwhite] set arg_error_CLR(cmdname) [a+ brightwhite]
set arg_error_CLR(groupname) [a+ bold] set arg_error_CLR(groupname) [a+ bold]
set arg_error_CLR(ansiborder) [a+ bold] set arg_error_CLR(ansiborder) [a+ bold]
@ -3380,7 +3381,7 @@ tcl::namespace::eval punk::args {
#set RST [a] #set RST [a]
set RST "\x1b\[m" set RST "\x1b\[0m"
set t "" ;#possible oo table object - may be tested for objectiness at the end so needs to exist. set t "" ;#possible oo table object - may be tested for objectiness at the end so needs to exist.
#REVIEW - risk of accidental indefinite recursion if functions used here also use punk::args::get_dict and there is an argument error #REVIEW - risk of accidental indefinite recursion if functions used here also use punk::args::get_dict and there is an argument error
@ -3442,7 +3443,8 @@ tcl::namespace::eval punk::args {
if {$cmdhelp ne ""} { if {$cmdhelp ne ""} {
lappend blank_header_col "" lappend blank_header_col ""
#set cmdhelp_display [a+ brightwhite]$cmdhelp[a] #set cmdhelp_display [a+ brightwhite]$cmdhelp[a]
set cmdhelp_display [textblock::ansibase_lines $cmdhelp $CLR(linebase_header)] #set cmdhelp_display [textblock::ansibase_lines $cmdhelp $CLR(linebase_header)]
set cmdhelp_display [punk::ansi::ansiwrap_raw $CLR(linebase_header) "" "" $cmdhelp]
} else { } else {
set cmdhelp_display "" set cmdhelp_display ""
} }
@ -4040,8 +4042,16 @@ tcl::namespace::eval punk::args {
$obj configure_column $i -blockalign left $obj configure_column $i -blockalign left
incr i incr i
} }
append help \n[textblock::join -- " " [$obj print]] append help \n[textblock::join -- " " [$obj print]]
#-------------
#todo - tests
#see special case double reset at end of content in textblock class table get_column_by_index
#bug fixed - needed to ensure last two resets were actually concurrent and at end.
#append help "\nbase[a+ green]ab\nc[a]base" ;#ok
#vs
#append help "\nbase[a+ green]a[a]b\nc[a]base" ;#not ok
#-------------
#set ansititle [dict get [$obj configure -title] value] #set ansititle [dict get [$obj configure -title] value]
$obj destroy $obj destroy
} }
@ -4239,9 +4249,13 @@ tcl::namespace::eval punk::args {
if {[info object isa object $t]} { if {[info object isa object $t]} {
set result $t set result $t
} }
} else {
#put original error at bottom of table too
append result \n $msg
} }
} else { } else {
set result $errmsg set result $errmsg
append result \n $msg
} }
if {$as_error} { if {$as_error} {
#add PUNK to the tail end of the more usual -errorcode {TCL WRONGARGS} so we maintain reasonable compat with things looking for TCL WRONGARGS - but also differentiate it. #add PUNK to the tail end of the more usual -errorcode {TCL WRONGARGS} so we maintain reasonable compat with things looking for TCL WRONGARGS - but also differentiate it.

42
src/project_layouts/custom/_project/punk.project-0.1/src/bootsupport/modules/textblock-0.1.3.tm

@ -2534,24 +2534,26 @@ tcl::namespace::eval textblock {
set parts [punk::ansi::ta::split_codes_single $c] set parts [punk::ansi::ta::split_codes_single $c]
#we have detected ansi - so there will always be at least 3 parts beginning and ending with pt pt,ansi,pt,ansi...,pt #we have detected ansi - so there will always be at least 3 parts beginning and ending with pt pt,ansi,pt,ansi...,pt
set codes [list] set codes [list]
set ptlens [list]
foreach {pt cd} $parts { foreach {pt cd} $parts {
if {$cd ne ""} {
lappend codes $cd lappend codes $cd
} lappend ptlens [string length $pt]
} }
#set takebg [lindex $parts end-1] #set takebg [lindex $parts end-1]
#set cell_bg [punk::ansi::codetype::sgr_merge_singles [list $takebg] -filter_fg 1] #set cell_bg [punk::ansi::codetype::sgr_merge_singles [list $takebg] -filter_fg 1]
set cell_bg [punk::ansi::codetype::sgr_merge_singles $codes -filter_fg 1 -filter_reset 1] set cell_bg [punk::ansi::codetype::sgr_merge_singles $codes -filter_fg 1 -filter_reset 1]
#puts --->[ansistring VIEW $codes] #puts --->[ansistring VIEW $codes]
if {[punk::ansi::codetype::is_sgr_reset [lindex $codes end]]} {
if {[punk::ansi::codetype::is_sgr_reset [lindex $codes end-1]]} { if {[punk::ansi::codetype::is_sgr_reset [lindex $codes end-1]]} {
if {[lindex $ptlens end] == 0 && [lindex $ptlens end-1] == 0 && [punk::ansi::codetype::is_sgr_reset [lindex $codes end-2]]} {
#special case double reset at end of content #special case double reset at end of content
set cell_ansi_tail [punk::ansi::codetype::sgr_merge_singles $codes] ;#no filters #TODO - write test!
set cell_ansi_tail [punk::ansi::codetype::sgr_merge_singles [lrange $codes 0 end-3]] ;#no filters
set ansibase "" set ansibase ""
set row_ansibase "" set row_ansibase ""
if {$ftblock} { if {$ftblock} {
set ansiborder_final [punk::ansi::codetype::sgr_merge [list $ansiborder_body_col_row] -filter_bg 1] set ansiborder_final [punk::ansi::codetype::sgr_merge [list $ansiborder_body_col_row] -filter_bg 1]
set ansiborder_final [punk::ansi::codetype::sgr_merge [list $ansiborder_final $cell_bg]]
} }
set cell_ansibase $cell_ansi_tail set cell_ansibase $cell_ansi_tail
} else { } else {
@ -2565,6 +2567,28 @@ tcl::namespace::eval textblock {
} }
set cell_ansibase $cell_bg set cell_ansibase $cell_bg
} }
#v1
#if {[punk::ansi::codetype::is_sgr_reset [lindex $codes end]]} {
# if {[punk::ansi::codetype::is_sgr_reset [lindex $codes end-1]]} {
# #special case double reset at end of content
# set cell_ansi_tail [punk::ansi::codetype::sgr_merge_singles $codes] ;#no filters
# set ansibase ""
# set row_ansibase ""
# if {$ftblock} {
# set ansiborder_final [punk::ansi::codetype::sgr_merge [list $ansiborder_body_col_row] -filter_bg 1]
# }
# set cell_ansibase $cell_ansi_tail
# } else {
# #single trailing reset in content
# set cell_ansibase "" ;#cell doesn't contribute to frame's ansibase
# }
#} else {
# if {$ftblock} {
# #no resets - use cell's bg to extend to the border - only for block frames
# set ansiborder_final $ansiborder_body_col_row$cell_bg
# }
# set cell_ansibase $cell_bg
#}
} }
set ansibase_final $ansibase$row_ansibase$cell_ansibase set ansibase_final $ansibase$row_ansibase$cell_ansibase
@ -8629,8 +8653,11 @@ tcl::namespace::eval textblock {
if {$opt_ansibase ne ""} { if {$opt_ansibase ne ""} {
if {[punk::ansi::ta::detect $cache_inner]} { if {[punk::ansi::ta::detect $cache_inner]} {
#set cache_inner [punk::ansi::ansiwrap -rawansi $opt_ansibase $cache_inner] #set cache_inner [punk::ansi::ansiwrap -rawansi $opt_ansibase $cache_inner]
set cache_inner [punk::ansi::ansiwrap_raw $opt_ansibase "" "" $cache_inner] #set cache_inner [punk::ansi::ansiwrap_raw $opt_ansibase "" "" $cache_inner]
#jjj ??? review
set cache_inner [punk::ansi::ansiwrap_raw $opt_ansibase "\x1b\[m" "" $cache_inner]
} else { } else {
#!!!
set cache_inner "$opt_ansibase$cache_inner\x1b\[0m" set cache_inner "$opt_ansibase$cache_inner\x1b\[0m"
} }
} }
@ -8723,7 +8750,10 @@ tcl::namespace::eval textblock {
if {$opt_ansibase ne ""} { if {$opt_ansibase ne ""} {
if {$contents_has_ansi} { if {$contents_has_ansi} {
#set contents [punk::ansi::ansiwrap -rawansi $opt_ansibase $contents] #set contents [punk::ansi::ansiwrap -rawansi $opt_ansibase $contents]
set contents [punk::ansi::ansiwrap_raw $opt_ansibase "" "" $contents] #set contents [punk::ansi::ansiwrap_raw $opt_ansibase "" "" $contents]
#jjj
set contents [punk::ansi::ansiwrap_raw $opt_ansibase "\x1b\[m" "" $contents]
#set contents "$opt_ansibase$contents\x1b\[0m"
} else { } else {
set contents "$opt_ansibase$contents\x1b\[0m" set contents "$opt_ansibase$contents\x1b\[0m"
set contents_has_ansi 1 set contents_has_ansi 1

36
src/project_layouts/custom/_project/punk.shell-0.1/src/bootsupport/modules/punk/ansi-0.1.1.tm

@ -3789,6 +3789,7 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
set emit "" set emit ""
#set parts [punk::ansi::ta::split_codes $text] #set parts [punk::ansi::ta::split_codes $text]
set parts [punk::ansi::ta::split_codes_single $text] set parts [punk::ansi::ta::split_codes_single $text]
set prevcode ""
foreach {pt code} $parts { foreach {pt code} $parts {
switch -- [llength $codestack] { switch -- [llength $codestack] {
0 { 0 {
@ -3809,6 +3810,7 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
} }
#parts ends on a pt - last code always empty string #parts ends on a pt - last code always empty string
if {$code ne ""} { if {$code ne ""} {
set prevcode $code
set c1c2 [tcl::string::range $code 0 1] set c1c2 [tcl::string::range $code 0 1]
set leadernorm [tcl::string::range [tcl::string::map [list\ set leadernorm [tcl::string::range [tcl::string::map [list\
\x1b\[ 7CSI\ \x1b\[ 7CSI\
@ -3827,7 +3829,8 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
set codestack [lremove $codestack {*}$dup_posns] set codestack [lremove $codestack {*}$dup_posns]
lappend codestack $code lappend codestack $code
} else { } else {
#jjtest
append emit $code
} }
} }
7GFX { 7GFX {
@ -3839,12 +3842,23 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
set o_gx_state off set o_gx_state off
} }
} }
#jjtest
append emit $code
} }
default { default {
#other ansi codes #other ansi codes
#jjtest
append emit $code
} }
} }
append emit $code #jjtest
#append emit $code
} else {
#jjtest
#code is only empty when processing final pt
if {$pt eq ""} {
append emit $prevcode
}
} }
} }
return [append emit $R] return [append emit $R]
@ -3882,6 +3896,7 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
set emit "" set emit ""
#set parts [punk::ansi::ta::split_codes $text] #set parts [punk::ansi::ta::split_codes $text]
set parts [punk::ansi::ta::split_codes_single $text] set parts [punk::ansi::ta::split_codes_single $text]
set prevcode ""
foreach {pt code} $parts { foreach {pt code} $parts {
switch -- [llength $codestack] { switch -- [llength $codestack] {
0 { 0 {
@ -3902,6 +3917,7 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
} }
#parts ends on a pt - last code always empty string #parts ends on a pt - last code always empty string
if {$code ne ""} { if {$code ne ""} {
set prevcode $code
set c1c2 [tcl::string::range $code 0 1] set c1c2 [tcl::string::range $code 0 1]
set leadernorm [tcl::string::range [tcl::string::map [list\ set leadernorm [tcl::string::range [tcl::string::map [list\
\x1b\[ 7CSI\ \x1b\[ 7CSI\
@ -3920,7 +3936,8 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
set codestack [lremove $codestack {*}$dup_posns] set codestack [lremove $codestack {*}$dup_posns]
lappend codestack $code lappend codestack $code
} else { } else {
#jjtest
apend emit $code
} }
} }
7GFX { 7GFX {
@ -3932,12 +3949,23 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
set o_gx_state off set o_gx_state off
} }
} }
#jjtest
append emit $code
} }
default { default {
#other ansi codes #other ansi codes
#jjtest
append emit $code
} }
} }
append emit $code #jjtest
#append emit $code
} else {
#jjtest
#code is only empty when processing final pt
if {$pt eq ""} {
append emit $prevcode
}
} }
} }
return [append emit $R] return [append emit $R]

20
src/project_layouts/custom/_project/punk.shell-0.1/src/bootsupport/modules/punk/args-0.2.tm

@ -3169,6 +3169,7 @@ tcl::namespace::eval punk::args {
set arg_error_CLR(goodarg) [a+ green strike] set arg_error_CLR(goodarg) [a+ green strike]
set arg_error_CLR(goodchoice) [a+ reverse] set arg_error_CLR(goodchoice) [a+ reverse]
set arg_error_CLR(linebase_header) [a+ white] set arg_error_CLR(linebase_header) [a+ white]
set arg_error_CLR(linebase) [a+ white]
set arg_error_CLR(cmdname) [a+ brightwhite] set arg_error_CLR(cmdname) [a+ brightwhite]
set arg_error_CLR(groupname) [a+ bold] set arg_error_CLR(groupname) [a+ bold]
set arg_error_CLR(ansiborder) [a+ bold] set arg_error_CLR(ansiborder) [a+ bold]
@ -3380,7 +3381,7 @@ tcl::namespace::eval punk::args {
#set RST [a] #set RST [a]
set RST "\x1b\[m" set RST "\x1b\[0m"
set t "" ;#possible oo table object - may be tested for objectiness at the end so needs to exist. set t "" ;#possible oo table object - may be tested for objectiness at the end so needs to exist.
#REVIEW - risk of accidental indefinite recursion if functions used here also use punk::args::get_dict and there is an argument error #REVIEW - risk of accidental indefinite recursion if functions used here also use punk::args::get_dict and there is an argument error
@ -3442,7 +3443,8 @@ tcl::namespace::eval punk::args {
if {$cmdhelp ne ""} { if {$cmdhelp ne ""} {
lappend blank_header_col "" lappend blank_header_col ""
#set cmdhelp_display [a+ brightwhite]$cmdhelp[a] #set cmdhelp_display [a+ brightwhite]$cmdhelp[a]
set cmdhelp_display [textblock::ansibase_lines $cmdhelp $CLR(linebase_header)] #set cmdhelp_display [textblock::ansibase_lines $cmdhelp $CLR(linebase_header)]
set cmdhelp_display [punk::ansi::ansiwrap_raw $CLR(linebase_header) "" "" $cmdhelp]
} else { } else {
set cmdhelp_display "" set cmdhelp_display ""
} }
@ -4040,8 +4042,16 @@ tcl::namespace::eval punk::args {
$obj configure_column $i -blockalign left $obj configure_column $i -blockalign left
incr i incr i
} }
append help \n[textblock::join -- " " [$obj print]] append help \n[textblock::join -- " " [$obj print]]
#-------------
#todo - tests
#see special case double reset at end of content in textblock class table get_column_by_index
#bug fixed - needed to ensure last two resets were actually concurrent and at end.
#append help "\nbase[a+ green]ab\nc[a]base" ;#ok
#vs
#append help "\nbase[a+ green]a[a]b\nc[a]base" ;#not ok
#-------------
#set ansititle [dict get [$obj configure -title] value] #set ansititle [dict get [$obj configure -title] value]
$obj destroy $obj destroy
} }
@ -4239,9 +4249,13 @@ tcl::namespace::eval punk::args {
if {[info object isa object $t]} { if {[info object isa object $t]} {
set result $t set result $t
} }
} else {
#put original error at bottom of table too
append result \n $msg
} }
} else { } else {
set result $errmsg set result $errmsg
append result \n $msg
} }
if {$as_error} { if {$as_error} {
#add PUNK to the tail end of the more usual -errorcode {TCL WRONGARGS} so we maintain reasonable compat with things looking for TCL WRONGARGS - but also differentiate it. #add PUNK to the tail end of the more usual -errorcode {TCL WRONGARGS} so we maintain reasonable compat with things looking for TCL WRONGARGS - but also differentiate it.

42
src/project_layouts/custom/_project/punk.shell-0.1/src/bootsupport/modules/textblock-0.1.3.tm

@ -2534,24 +2534,26 @@ tcl::namespace::eval textblock {
set parts [punk::ansi::ta::split_codes_single $c] set parts [punk::ansi::ta::split_codes_single $c]
#we have detected ansi - so there will always be at least 3 parts beginning and ending with pt pt,ansi,pt,ansi...,pt #we have detected ansi - so there will always be at least 3 parts beginning and ending with pt pt,ansi,pt,ansi...,pt
set codes [list] set codes [list]
set ptlens [list]
foreach {pt cd} $parts { foreach {pt cd} $parts {
if {$cd ne ""} {
lappend codes $cd lappend codes $cd
} lappend ptlens [string length $pt]
} }
#set takebg [lindex $parts end-1] #set takebg [lindex $parts end-1]
#set cell_bg [punk::ansi::codetype::sgr_merge_singles [list $takebg] -filter_fg 1] #set cell_bg [punk::ansi::codetype::sgr_merge_singles [list $takebg] -filter_fg 1]
set cell_bg [punk::ansi::codetype::sgr_merge_singles $codes -filter_fg 1 -filter_reset 1] set cell_bg [punk::ansi::codetype::sgr_merge_singles $codes -filter_fg 1 -filter_reset 1]
#puts --->[ansistring VIEW $codes] #puts --->[ansistring VIEW $codes]
if {[punk::ansi::codetype::is_sgr_reset [lindex $codes end]]} {
if {[punk::ansi::codetype::is_sgr_reset [lindex $codes end-1]]} { if {[punk::ansi::codetype::is_sgr_reset [lindex $codes end-1]]} {
if {[lindex $ptlens end] == 0 && [lindex $ptlens end-1] == 0 && [punk::ansi::codetype::is_sgr_reset [lindex $codes end-2]]} {
#special case double reset at end of content #special case double reset at end of content
set cell_ansi_tail [punk::ansi::codetype::sgr_merge_singles $codes] ;#no filters #TODO - write test!
set cell_ansi_tail [punk::ansi::codetype::sgr_merge_singles [lrange $codes 0 end-3]] ;#no filters
set ansibase "" set ansibase ""
set row_ansibase "" set row_ansibase ""
if {$ftblock} { if {$ftblock} {
set ansiborder_final [punk::ansi::codetype::sgr_merge [list $ansiborder_body_col_row] -filter_bg 1] set ansiborder_final [punk::ansi::codetype::sgr_merge [list $ansiborder_body_col_row] -filter_bg 1]
set ansiborder_final [punk::ansi::codetype::sgr_merge [list $ansiborder_final $cell_bg]]
} }
set cell_ansibase $cell_ansi_tail set cell_ansibase $cell_ansi_tail
} else { } else {
@ -2565,6 +2567,28 @@ tcl::namespace::eval textblock {
} }
set cell_ansibase $cell_bg set cell_ansibase $cell_bg
} }
#v1
#if {[punk::ansi::codetype::is_sgr_reset [lindex $codes end]]} {
# if {[punk::ansi::codetype::is_sgr_reset [lindex $codes end-1]]} {
# #special case double reset at end of content
# set cell_ansi_tail [punk::ansi::codetype::sgr_merge_singles $codes] ;#no filters
# set ansibase ""
# set row_ansibase ""
# if {$ftblock} {
# set ansiborder_final [punk::ansi::codetype::sgr_merge [list $ansiborder_body_col_row] -filter_bg 1]
# }
# set cell_ansibase $cell_ansi_tail
# } else {
# #single trailing reset in content
# set cell_ansibase "" ;#cell doesn't contribute to frame's ansibase
# }
#} else {
# if {$ftblock} {
# #no resets - use cell's bg to extend to the border - only for block frames
# set ansiborder_final $ansiborder_body_col_row$cell_bg
# }
# set cell_ansibase $cell_bg
#}
} }
set ansibase_final $ansibase$row_ansibase$cell_ansibase set ansibase_final $ansibase$row_ansibase$cell_ansibase
@ -8629,8 +8653,11 @@ tcl::namespace::eval textblock {
if {$opt_ansibase ne ""} { if {$opt_ansibase ne ""} {
if {[punk::ansi::ta::detect $cache_inner]} { if {[punk::ansi::ta::detect $cache_inner]} {
#set cache_inner [punk::ansi::ansiwrap -rawansi $opt_ansibase $cache_inner] #set cache_inner [punk::ansi::ansiwrap -rawansi $opt_ansibase $cache_inner]
set cache_inner [punk::ansi::ansiwrap_raw $opt_ansibase "" "" $cache_inner] #set cache_inner [punk::ansi::ansiwrap_raw $opt_ansibase "" "" $cache_inner]
#jjj ??? review
set cache_inner [punk::ansi::ansiwrap_raw $opt_ansibase "\x1b\[m" "" $cache_inner]
} else { } else {
#!!!
set cache_inner "$opt_ansibase$cache_inner\x1b\[0m" set cache_inner "$opt_ansibase$cache_inner\x1b\[0m"
} }
} }
@ -8723,7 +8750,10 @@ tcl::namespace::eval textblock {
if {$opt_ansibase ne ""} { if {$opt_ansibase ne ""} {
if {$contents_has_ansi} { if {$contents_has_ansi} {
#set contents [punk::ansi::ansiwrap -rawansi $opt_ansibase $contents] #set contents [punk::ansi::ansiwrap -rawansi $opt_ansibase $contents]
set contents [punk::ansi::ansiwrap_raw $opt_ansibase "" "" $contents] #set contents [punk::ansi::ansiwrap_raw $opt_ansibase "" "" $contents]
#jjj
set contents [punk::ansi::ansiwrap_raw $opt_ansibase "\x1b\[m" "" $contents]
#set contents "$opt_ansibase$contents\x1b\[0m"
} else { } else {
set contents "$opt_ansibase$contents\x1b\[0m" set contents "$opt_ansibase$contents\x1b\[0m"
set contents_has_ansi 1 set contents_has_ansi 1

2
src/vfs/_vfscommon.vfs/lib/icons/icons.tcl

@ -18,7 +18,7 @@
# -items # # -items #
#=======================================================================# #=======================================================================#
package require Tk 8.0 package require Tk 8.0-
package provide icons 1.0 package provide icons 1.0
#=======================================================================# #=======================================================================#

36
src/vfs/_vfscommon.vfs/modules/punk/ansi-0.1.1.tm

@ -3789,6 +3789,7 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
set emit "" set emit ""
#set parts [punk::ansi::ta::split_codes $text] #set parts [punk::ansi::ta::split_codes $text]
set parts [punk::ansi::ta::split_codes_single $text] set parts [punk::ansi::ta::split_codes_single $text]
set prevcode ""
foreach {pt code} $parts { foreach {pt code} $parts {
switch -- [llength $codestack] { switch -- [llength $codestack] {
0 { 0 {
@ -3809,6 +3810,7 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
} }
#parts ends on a pt - last code always empty string #parts ends on a pt - last code always empty string
if {$code ne ""} { if {$code ne ""} {
set prevcode $code
set c1c2 [tcl::string::range $code 0 1] set c1c2 [tcl::string::range $code 0 1]
set leadernorm [tcl::string::range [tcl::string::map [list\ set leadernorm [tcl::string::range [tcl::string::map [list\
\x1b\[ 7CSI\ \x1b\[ 7CSI\
@ -3827,7 +3829,8 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
set codestack [lremove $codestack {*}$dup_posns] set codestack [lremove $codestack {*}$dup_posns]
lappend codestack $code lappend codestack $code
} else { } else {
#jjtest
append emit $code
} }
} }
7GFX { 7GFX {
@ -3839,12 +3842,23 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
set o_gx_state off set o_gx_state off
} }
} }
#jjtest
append emit $code
} }
default { default {
#other ansi codes #other ansi codes
#jjtest
append emit $code
} }
} }
append emit $code #jjtest
#append emit $code
} else {
#jjtest
#code is only empty when processing final pt
if {$pt eq ""} {
append emit $prevcode
}
} }
} }
return [append emit $R] return [append emit $R]
@ -3882,6 +3896,7 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
set emit "" set emit ""
#set parts [punk::ansi::ta::split_codes $text] #set parts [punk::ansi::ta::split_codes $text]
set parts [punk::ansi::ta::split_codes_single $text] set parts [punk::ansi::ta::split_codes_single $text]
set prevcode ""
foreach {pt code} $parts { foreach {pt code} $parts {
switch -- [llength $codestack] { switch -- [llength $codestack] {
0 { 0 {
@ -3902,6 +3917,7 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
} }
#parts ends on a pt - last code always empty string #parts ends on a pt - last code always empty string
if {$code ne ""} { if {$code ne ""} {
set prevcode $code
set c1c2 [tcl::string::range $code 0 1] set c1c2 [tcl::string::range $code 0 1]
set leadernorm [tcl::string::range [tcl::string::map [list\ set leadernorm [tcl::string::range [tcl::string::map [list\
\x1b\[ 7CSI\ \x1b\[ 7CSI\
@ -3920,7 +3936,8 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
set codestack [lremove $codestack {*}$dup_posns] set codestack [lremove $codestack {*}$dup_posns]
lappend codestack $code lappend codestack $code
} else { } else {
#jjtest
apend emit $code
} }
} }
7GFX { 7GFX {
@ -3932,12 +3949,23 @@ Brightblack 100 Brightred 101 Brightgreen 102 Brightyellow 103 Brightblu
set o_gx_state off set o_gx_state off
} }
} }
#jjtest
append emit $code
} }
default { default {
#other ansi codes #other ansi codes
#jjtest
append emit $code
} }
} }
append emit $code #jjtest
#append emit $code
} else {
#jjtest
#code is only empty when processing final pt
if {$pt eq ""} {
append emit $prevcode
}
} }
} }
return [append emit $R] return [append emit $R]

20
src/vfs/_vfscommon.vfs/modules/punk/args-0.2.tm

@ -3169,6 +3169,7 @@ tcl::namespace::eval punk::args {
set arg_error_CLR(goodarg) [a+ green strike] set arg_error_CLR(goodarg) [a+ green strike]
set arg_error_CLR(goodchoice) [a+ reverse] set arg_error_CLR(goodchoice) [a+ reverse]
set arg_error_CLR(linebase_header) [a+ white] set arg_error_CLR(linebase_header) [a+ white]
set arg_error_CLR(linebase) [a+ white]
set arg_error_CLR(cmdname) [a+ brightwhite] set arg_error_CLR(cmdname) [a+ brightwhite]
set arg_error_CLR(groupname) [a+ bold] set arg_error_CLR(groupname) [a+ bold]
set arg_error_CLR(ansiborder) [a+ bold] set arg_error_CLR(ansiborder) [a+ bold]
@ -3380,7 +3381,7 @@ tcl::namespace::eval punk::args {
#set RST [a] #set RST [a]
set RST "\x1b\[m" set RST "\x1b\[0m"
set t "" ;#possible oo table object - may be tested for objectiness at the end so needs to exist. set t "" ;#possible oo table object - may be tested for objectiness at the end so needs to exist.
#REVIEW - risk of accidental indefinite recursion if functions used here also use punk::args::get_dict and there is an argument error #REVIEW - risk of accidental indefinite recursion if functions used here also use punk::args::get_dict and there is an argument error
@ -3442,7 +3443,8 @@ tcl::namespace::eval punk::args {
if {$cmdhelp ne ""} { if {$cmdhelp ne ""} {
lappend blank_header_col "" lappend blank_header_col ""
#set cmdhelp_display [a+ brightwhite]$cmdhelp[a] #set cmdhelp_display [a+ brightwhite]$cmdhelp[a]
set cmdhelp_display [textblock::ansibase_lines $cmdhelp $CLR(linebase_header)] #set cmdhelp_display [textblock::ansibase_lines $cmdhelp $CLR(linebase_header)]
set cmdhelp_display [punk::ansi::ansiwrap_raw $CLR(linebase_header) "" "" $cmdhelp]
} else { } else {
set cmdhelp_display "" set cmdhelp_display ""
} }
@ -4040,8 +4042,16 @@ tcl::namespace::eval punk::args {
$obj configure_column $i -blockalign left $obj configure_column $i -blockalign left
incr i incr i
} }
append help \n[textblock::join -- " " [$obj print]] append help \n[textblock::join -- " " [$obj print]]
#-------------
#todo - tests
#see special case double reset at end of content in textblock class table get_column_by_index
#bug fixed - needed to ensure last two resets were actually concurrent and at end.
#append help "\nbase[a+ green]ab\nc[a]base" ;#ok
#vs
#append help "\nbase[a+ green]a[a]b\nc[a]base" ;#not ok
#-------------
#set ansititle [dict get [$obj configure -title] value] #set ansititle [dict get [$obj configure -title] value]
$obj destroy $obj destroy
} }
@ -4239,9 +4249,13 @@ tcl::namespace::eval punk::args {
if {[info object isa object $t]} { if {[info object isa object $t]} {
set result $t set result $t
} }
} else {
#put original error at bottom of table too
append result \n $msg
} }
} else { } else {
set result $errmsg set result $errmsg
append result \n $msg
} }
if {$as_error} { if {$as_error} {
#add PUNK to the tail end of the more usual -errorcode {TCL WRONGARGS} so we maintain reasonable compat with things looking for TCL WRONGARGS - but also differentiate it. #add PUNK to the tail end of the more usual -errorcode {TCL WRONGARGS} so we maintain reasonable compat with things looking for TCL WRONGARGS - but also differentiate it.

4
src/vfs/_vfscommon.vfs/modules/punk/args/tclcore-0.1.0.tm

@ -3425,8 +3425,8 @@ tcl::namespace::eval punk::args::tclcore {
@opts -type string -parsekey "" -group "NESTED LIST OPTIONS" -grouphelp\ @opts -type string -parsekey "" -group "NESTED LIST OPTIONS" -grouphelp\
"These options are used to search lists of lists. They may be used with any other options." "These options are used to search lists of lists. They may be used with any other options."
-stride -type integer -default 1 -typesynopsis strideLength -help\ -stride -type integer -default 1 -typesynopsis strideLength -help\
"If this option is specified, the list is treated as consisting of groups of strideLength elements and the "If this option is specified, the list is treated as consisting of groups of ${$I}strideLength${$NI} elements and the
groups are searched by either their first element or, if the -index option is used, by the element within groups are searched by either their first element or, if the ${$B}-index${$N} option is used, by the element within
each group given by the first index passed to -index (which is then ignored by -index). The resulting each group given by the first index passed to -index (which is then ignored by -index). The resulting
index always points to the first element in a group. index always points to the first element in a group.
The list length must be an integer multiple of strideLength, which in turn must be at least 1. A The list length must be an integer multiple of strideLength, which in turn must be at least 1. A

3
src/vfs/_vfscommon.vfs/modules/punk/repl-0.1.2.tm

@ -2567,7 +2567,8 @@ proc repl::repl_process_data {inputchan chunktype chunk stdinlines prompt_config
set c [a yellow bold] set c [a yellow bold]
set n [a] set n [a]
rputs stderr $c$result$n #rputs stderr $c$result$n
rputs [punk::ansi::ansiwrap_raw $c "\x1b\[m" "" $result]
#tcl err hint prompt - lowercase #tcl err hint prompt - lowercase
doprompt "p% " doprompt "p% "
} }

42
src/vfs/_vfscommon.vfs/modules/textblock-0.1.3.tm

@ -2534,24 +2534,26 @@ tcl::namespace::eval textblock {
set parts [punk::ansi::ta::split_codes_single $c] set parts [punk::ansi::ta::split_codes_single $c]
#we have detected ansi - so there will always be at least 3 parts beginning and ending with pt pt,ansi,pt,ansi...,pt #we have detected ansi - so there will always be at least 3 parts beginning and ending with pt pt,ansi,pt,ansi...,pt
set codes [list] set codes [list]
set ptlens [list]
foreach {pt cd} $parts { foreach {pt cd} $parts {
if {$cd ne ""} {
lappend codes $cd lappend codes $cd
} lappend ptlens [string length $pt]
} }
#set takebg [lindex $parts end-1] #set takebg [lindex $parts end-1]
#set cell_bg [punk::ansi::codetype::sgr_merge_singles [list $takebg] -filter_fg 1] #set cell_bg [punk::ansi::codetype::sgr_merge_singles [list $takebg] -filter_fg 1]
set cell_bg [punk::ansi::codetype::sgr_merge_singles $codes -filter_fg 1 -filter_reset 1] set cell_bg [punk::ansi::codetype::sgr_merge_singles $codes -filter_fg 1 -filter_reset 1]
#puts --->[ansistring VIEW $codes] #puts --->[ansistring VIEW $codes]
if {[punk::ansi::codetype::is_sgr_reset [lindex $codes end]]} {
if {[punk::ansi::codetype::is_sgr_reset [lindex $codes end-1]]} { if {[punk::ansi::codetype::is_sgr_reset [lindex $codes end-1]]} {
if {[lindex $ptlens end] == 0 && [lindex $ptlens end-1] == 0 && [punk::ansi::codetype::is_sgr_reset [lindex $codes end-2]]} {
#special case double reset at end of content #special case double reset at end of content
set cell_ansi_tail [punk::ansi::codetype::sgr_merge_singles $codes] ;#no filters #TODO - write test!
set cell_ansi_tail [punk::ansi::codetype::sgr_merge_singles [lrange $codes 0 end-3]] ;#no filters
set ansibase "" set ansibase ""
set row_ansibase "" set row_ansibase ""
if {$ftblock} { if {$ftblock} {
set ansiborder_final [punk::ansi::codetype::sgr_merge [list $ansiborder_body_col_row] -filter_bg 1] set ansiborder_final [punk::ansi::codetype::sgr_merge [list $ansiborder_body_col_row] -filter_bg 1]
set ansiborder_final [punk::ansi::codetype::sgr_merge [list $ansiborder_final $cell_bg]]
} }
set cell_ansibase $cell_ansi_tail set cell_ansibase $cell_ansi_tail
} else { } else {
@ -2565,6 +2567,28 @@ tcl::namespace::eval textblock {
} }
set cell_ansibase $cell_bg set cell_ansibase $cell_bg
} }
#v1
#if {[punk::ansi::codetype::is_sgr_reset [lindex $codes end]]} {
# if {[punk::ansi::codetype::is_sgr_reset [lindex $codes end-1]]} {
# #special case double reset at end of content
# set cell_ansi_tail [punk::ansi::codetype::sgr_merge_singles $codes] ;#no filters
# set ansibase ""
# set row_ansibase ""
# if {$ftblock} {
# set ansiborder_final [punk::ansi::codetype::sgr_merge [list $ansiborder_body_col_row] -filter_bg 1]
# }
# set cell_ansibase $cell_ansi_tail
# } else {
# #single trailing reset in content
# set cell_ansibase "" ;#cell doesn't contribute to frame's ansibase
# }
#} else {
# if {$ftblock} {
# #no resets - use cell's bg to extend to the border - only for block frames
# set ansiborder_final $ansiborder_body_col_row$cell_bg
# }
# set cell_ansibase $cell_bg
#}
} }
set ansibase_final $ansibase$row_ansibase$cell_ansibase set ansibase_final $ansibase$row_ansibase$cell_ansibase
@ -8629,8 +8653,11 @@ tcl::namespace::eval textblock {
if {$opt_ansibase ne ""} { if {$opt_ansibase ne ""} {
if {[punk::ansi::ta::detect $cache_inner]} { if {[punk::ansi::ta::detect $cache_inner]} {
#set cache_inner [punk::ansi::ansiwrap -rawansi $opt_ansibase $cache_inner] #set cache_inner [punk::ansi::ansiwrap -rawansi $opt_ansibase $cache_inner]
set cache_inner [punk::ansi::ansiwrap_raw $opt_ansibase "" "" $cache_inner] #set cache_inner [punk::ansi::ansiwrap_raw $opt_ansibase "" "" $cache_inner]
#jjj ??? review
set cache_inner [punk::ansi::ansiwrap_raw $opt_ansibase "\x1b\[m" "" $cache_inner]
} else { } else {
#!!!
set cache_inner "$opt_ansibase$cache_inner\x1b\[0m" set cache_inner "$opt_ansibase$cache_inner\x1b\[0m"
} }
} }
@ -8723,7 +8750,10 @@ tcl::namespace::eval textblock {
if {$opt_ansibase ne ""} { if {$opt_ansibase ne ""} {
if {$contents_has_ansi} { if {$contents_has_ansi} {
#set contents [punk::ansi::ansiwrap -rawansi $opt_ansibase $contents] #set contents [punk::ansi::ansiwrap -rawansi $opt_ansibase $contents]
set contents [punk::ansi::ansiwrap_raw $opt_ansibase "" "" $contents] #set contents [punk::ansi::ansiwrap_raw $opt_ansibase "" "" $contents]
#jjj
set contents [punk::ansi::ansiwrap_raw $opt_ansibase "\x1b\[m" "" $contents]
#set contents "$opt_ansibase$contents\x1b\[0m"
} else { } else {
set contents "$opt_ansibase$contents\x1b\[0m" set contents "$opt_ansibase$contents\x1b\[0m"
set contents_has_ansi 1 set contents_has_ansi 1

Loading…
Cancel
Save