#todo - something better - the 'channel' concept may not really apply on unix, as raw mode is for input and output modes
#todo - something better - the 'channel' concept may not really apply on unix, as raw mode is set for input and output modes currently - only valid to set on a readable channel?
#on windows they can be set independently (but not with stty) - REVIEW
#NOTE - the is_raw is only being set in current interp - but the channel is shared.
#this is problematic with the repl thread being separate. - must be a tsv? REVIEW
#can we even put a spinner so we don't keep emitting lines? We probably can't use any ansi functions that need to get a response on stdin..(like get_cursor_pos)
#punk::console::get_size is problematic if -winsize not available on the stdout channel - which is the case for certain 8.6 versions at least.. platform variances?
## can't do this: set screeninfo [punk::console::get_size]; lassign $screeninfo _c cols _r rows
set outconf [chan configure stdout]
set RED [punk::ansi::a+ red bold]; set RST [punk::ansi::a]
set msg "${RED}fblocked $inputchan is true. (line-length Tcl windows channel bug?) Hit enter to continue$RST"
if {"windows" eq $::tcl_platform(platform)} {
set msg "${RED}$inputchan fblocked is true. (line-length Tcl windows channel bug?)$RST \{$allwaiting\}"
} else {
set msg "${RED}$inputchan fblocked is true.$RST \{$allwaiting\}"
}
set cols ""
set rows ""
if {[dict exists $outconf -winsize]} {
lassign [dict get $outconf -winsize] cols rows
} else {
#fallback - try external executable. Which is a bit ugly
#tput can work on windows too if it's installed e.g from msys2
#but can be *slow* compared to unix e.g 400ms+ vs <2ms on FreeBSD !
set tputcmd [auto_execok tput]
if {$tputcmd ne ""} {
if {![catch {exec {*}$tputcmd cols lines} values} {
lassign $values cols rows
}
}
}
if {[string is integer -strict $cols] && [string is integer -strict $rows]} {
#todo - something better - the 'channel' concept may not really apply on unix, as raw mode is for input and output modes
#todo - something better - the 'channel' concept may not really apply on unix, as raw mode is set for input and output modes currently - only valid to set on a readable channel?
#on windows they can be set independently (but not with stty) - REVIEW
#NOTE - the is_raw is only being set in current interp - but the channel is shared.
#this is problematic with the repl thread being separate. - must be a tsv? REVIEW
#can we even put a spinner so we don't keep emitting lines? We probably can't use any ansi functions that need to get a response on stdin..(like get_cursor_pos)
#punk::console::get_size is problematic if -winsize not available on the stdout channel - which is the case for certain 8.6 versions at least.. platform variances?
## can't do this: set screeninfo [punk::console::get_size]; lassign $screeninfo _c cols _r rows
set outconf [chan configure stdout]
set RED [punk::ansi::a+ red bold]; set RST [punk::ansi::a]
set msg "${RED}fblocked $inputchan is true. (line-length Tcl windows channel bug?) Hit enter to continue$RST"
if {"windows" eq $::tcl_platform(platform)} {
set msg "${RED}$inputchan fblocked is true. (line-length Tcl windows channel bug?)$RST \{$allwaiting\}"
} else {
set msg "${RED}$inputchan fblocked is true.$RST \{$allwaiting\}"
}
set cols ""
set rows ""
if {[dict exists $outconf -winsize]} {
lassign [dict get $outconf -winsize] cols rows
} else {
#fallback - try external executable. Which is a bit ugly
#tput can work on windows too if it's installed e.g from msys2
#but can be *slow* compared to unix e.g 400ms+ vs <2ms on FreeBSD !
set tputcmd [auto_execok tput]
if {$tputcmd ne ""} {
if {![catch {exec {*}$tputcmd cols lines} values} {
lassign $values cols rows
}
}
}
if {[string is integer -strict $cols] && [string is integer -strict $rows]} {