From fb48b391eabfa81c9b89637f5dfe1904a42e8359 Mon Sep 17 00:00:00 2001 From: Julian Noble Date: Fri, 22 Mar 2024 05:40:05 +1100 Subject: [PATCH] fix telnet local echo when server is echoing --- src/modules/punk/basictelnet-999999.0a1.0.tm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/punk/basictelnet-999999.0a1.0.tm b/src/modules/punk/basictelnet-999999.0a1.0.tm index f301cdb..59a276e 100644 --- a/src/modules/punk/basictelnet-999999.0a1.0.tm +++ b/src/modules/punk/basictelnet-999999.0a1.0.tm @@ -396,6 +396,7 @@ namespace eval punk::basictelnet { #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.) proc toServer {sock} { + variable server_option_state upvar ::punk::console::input_chunks_waiting input_chunks_waiting set nextwaiting "" @@ -425,7 +426,8 @@ namespace eval punk::basictelnet { } # - review - if {$::punk::console::is_raw} { + #if we didn't make agreement that server would echo and we're in raw mode + if {![dict get $server_option_state 1] && $::punk::console::is_raw} { puts -nonewline stdout $chunk } # -- --- --- --- @@ -523,6 +525,7 @@ namespace eval punk::basictelnet { } #write [string range $data 0 $idx-1] puts -nonewline stdout [encoding convertfrom utf-8 [string range $data 0 $idx-1]] + flush stdout set byte [string index $data [expr {$idx+1}]] incr idx 2 if {$byte < "\xef"} {