# empty list [a] should do reset - same for [a nonexistant]
# explicit reset at beginning of parameter list for a= (as opposed to a+)
set t [linsert $t[unset t] 0 0]
if {[![llength $e]]} {
set result "\x1b\[[join $t {;}]m"
} else {
set result "\x1b\[[join $t {;}]m\x1b\[[join $e {;}]m"
}
dict set sgr_cache a_$args $result
return $result
}
@ -3397,6 +3550,7 @@ namespace eval punk::ansi {
dict set codestate italic 3
}
4 {
#REVIEW - merging extended (e.g 4:4) underline attributes suppresses all other SGR attributes on at least some terminals which don't support extended underlines
error "textblock::table::configure_header -colspans first value '$firstspan' must be integer > 0 or the string \"all\""
error "textblock::table::configure_header -colspans first value '$firstspan' must be integer > 0 & <= $numcols or the string \"all\""
}
#we don't mind if there are less colspans specified than columns.. the tail can be deduced from the leading ones specified (review)
set remaining $firstspan
if {$remaining ne "all"} {
incr remaining -1
}
set spanview $v
set sidx 1
#because we allow 'all' - be careful when doing < or > comparisons - as we are mixing integer and string comparisons if we don't test for 'all' first
foreach span [lrange $v 1 end] {
if {$remaining eq "all"} {
if {$span eq "all"} {
set remaining "all"
} elseif {$span > 0} {
#ok to reset to higher val immediately or after an all and any number of following zeros
if {$span > ($numcols - $sidx)} {
lset spanview $sidx [a+ web-red]$span[a]
error "textblock::table::configure_header -colspans sequence incorrect at span '$span'. Require span <= [expr {$numcols-$sidx}] or \"all\".[a] $spanview"
}
set remaining $span
incr remaining -1
} else {
#zero following an all - leave remaining as all
incr remaining -1
}
} else {
if {$span eq "0"} {
if {$remaining eq "0"} {
error "textblock::table::configure_header -colspans sequence incorrect at span '$span' remaining is $remaining - positive or \"all\" value span required"
lset spanview $sidx [a+ web-red]$span[a]
error "textblock::table::configure_header -colspans sequence incorrect at span '$span' remaining is $remaining. Require positive or \"all\" value.[a] $spanview"
} else {
incr remaining -1
}
} else {
if {$remaining eq "0"} {
#ok for new span value of all or > 0
if {$span ne "all" && $span > ($numcols - $sidx)} {
lset spanview $sidx [a+ web-red]$span[a]
error "textblock::table::configure_header -colspans sequence incorrect at span '$span'. Require span <= [expr {$numcols-$sidx}] or \"all\".[a] $spanview"
}
set remaining $span
if {$remaining ne "all"} {
incr remaining -1
}
} else {
error "textblock::table::configure_header -colspans sequence incorrect at span '$span' remaining is $remaining - zero value span required"
lset spanview $sidx [a+ web-red]$span[a]
error "textblock::table::configure_header -colspans sequence incorrect at span '$span' remaining is $remaining. Require zero value span.[a] $spanview"
}
}
}
incr sidx
}
}
#empty -colspans list should be ok
@ -5561,6 +5575,12 @@ namespace eval textblock {
}
#options before content argument - which is allowed to be absent
#frame performance (noticeable with complex tables even of modest size) is improved significantly by frame_cache - but is still (2024) a fairly expensive operation.
#
#consider if we can use -sticky nsew instead of -blockalign (as per Tk grid -sticky option)
# This would require some sort of expand equivalent e.g for -sticky ew or -sticky ns - for which we have to decide a meaning for text.. e.g ansi padding?
#We are framing 'rendered' text - so we don't have access to for example an inner frame or table to tell it to expand
#we could refactor as an object and provide a -return object option, then use stored -sticky data to influence how another object renders into it
# - but we would need to maintain support for the rendered-string based operations too.