if {[lindex $existing_handler 0] eq $this_handler} {
if {[lindex $existing_handler 0] eq $this_handler} {
puts stderr "[punk::ansi::a+ red]Warning for callid $callid get_ansi_response_payload called while existing ansi response handler in place[a]: $this_handler"
puts stderr "[punk::ansi::a+ red]Warning for callid $callid get_ansi_response_payload called while existing ansi response handler in place[a]: $this_handler"
puts stderr "queue state: $queue"
puts stderr "queue state: $queue"
flush stderr
if {[lindex $queue 0] ne $callid} {
if {[lindex $queue 0] ne $callid} {
while { $waitvar($callid) ne "go_ahead"} {
after 10
set waitvar([lindex $queue 0]) trigger
puts -nonewline stderr "\n[info level 1]\n"
puts -nonewline stderr "<callid:$callid waitvar [array get waitvar]>"
vwait ::punk::console::ansi_response_wait ;#wait on array - not specific element
}
#dict set queuedata $callid [list $query $capturingendregex $inputchannels]
#Looks like the existing handler is setup for punk repl cooperation.
#Looks like the existing handler is setup for punk repl cooperation.
puts stderr "[punk::ansi::a+ yellow bold]-->punk::console::get_ansi_response_payload triggering existing handler $existing_handler while over-read data is in punk::console::input_chunks_waiting($input) instead of channel[punk::ansi::a]"
puts stdout "\n\n[punk::ansi::a+ yellow bold]-->punk::console::get_ansi_response_payload callid $callid triggering existing handler\n $existing_handler while over-read data is in punk::console::input_chunks_waiting($input) instead of channel[punk::ansi::a]"
variable can_debug ;#we'll only support debug if we can use the punk ansi frame mechanism
variable can_debug ;#we'll only support debug if we can use the punk ansi frame mechanism
#The frame mechanism isn't as good as a proper split-screen as it redraws on rhs and looks bad in scrollback - but it's better than putting debug output on lhs in with data
#The frame mechanism isn't as good as a proper split-screen as it redraws on rhs and looks bad in scrollback - but it's better than putting debug output on lhs in with data
if {!$can_debug || !$debug} {return}
if {!$can_debug || !$debug} {return}
incr writing_debug_frame
#set existing_handler [fileevent stdin readable]
set infoframe [textblock::frame -width 80 -ansiborder [a+ green bold] -title "[a cyan]Telnet Debug[a]" $info]
set infoframe [textblock::frame -width 80 -ansiborder [a+ green bold] -title "[a cyan]Telnet Debug[a]" $info]
set w [textblock::width $infoframe]
set w [textblock::width $infoframe]
set spacepatch [textblock::block $w 4 " "]
set spacepatch [textblock::block $w 4 " "]
puts -nonewline [punk::ansi::cursor_off]
puts -nonewline [punk::ansi::cursor_off]
#use non cursorsave version - slower - but less likely to interfere with cursor operations in data
#use non cursorsave version - slower - but less likely to interfere with cursor operations in data
set existing_input_handler [fileevent $inputchannel readable] ;#stdin
fileevent $inputchannel readable {}
if {[string length $outputchannel]} {
set existing_output_handler [fileevent $outputchannel readable] ;#sock
#specifically named 'waiting' argument as last argument for cooperative input reading with other punk channel handlers (repl in particular)
#specifically named 'waiting' argument as last argument for cooperative input reading with other punk channel handlers (repl in particular)
#waiting data will be supplied to this handler if the other handler over-read (e.g repl handling ANSI ESC \[6n response on stdin finding other data before the ANSI response.)
#waiting data will be supplied to this handler if the other handler over-read (e.g repl handling ANSI ESC \[6n response on stdin finding other data before the ANSI response.)
if {[lindex $existing_handler 0] eq $this_handler} {
if {[lindex $existing_handler 0] eq $this_handler} {
puts stderr "[punk::ansi::a+ red]Warning for callid $callid get_ansi_response_payload called while existing ansi response handler in place[a]: $this_handler"
puts stderr "[punk::ansi::a+ red]Warning for callid $callid get_ansi_response_payload called while existing ansi response handler in place[a]: $this_handler"
puts stderr "queue state: $queue"
puts stderr "queue state: $queue"
flush stderr
if {[lindex $queue 0] ne $callid} {
if {[lindex $queue 0] ne $callid} {
while { $waitvar($callid) ne "go_ahead"} {
after 10
set waitvar([lindex $queue 0]) trigger
puts -nonewline stderr "\n[info level 1]\n"
puts -nonewline stderr "<callid:$callid waitvar [array get waitvar]>"
vwait ::punk::console::ansi_response_wait ;#wait on array - not specific element
}
#dict set queuedata $callid [list $query $capturingendregex $inputchannels]
#Looks like the existing handler is setup for punk repl cooperation.
#Looks like the existing handler is setup for punk repl cooperation.
puts stderr "[punk::ansi::a+ yellow bold]-->punk::console::get_ansi_response_payload triggering existing handler $existing_handler while over-read data is in punk::console::input_chunks_waiting($input) instead of channel[punk::ansi::a]"
puts stdout "\n\n[punk::ansi::a+ yellow bold]-->punk::console::get_ansi_response_payload callid $callid triggering existing handler\n $existing_handler while over-read data is in punk::console::input_chunks_waiting($input) instead of channel[punk::ansi::a]"