|
|
|
@ -30,6 +30,10 @@ namespace eval punk::console {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if {"windows" eq $::tcl_platform(platform)} { |
|
|
|
|
proc enableAnsi {} { |
|
|
|
|
define_windows_procs |
|
|
|
|
tailcall enableAnsi |
|
|
|
|
} |
|
|
|
|
proc enableRaw {{channel stdin}} { |
|
|
|
|
define_windows_procs |
|
|
|
|
tailcall enableRaw $channel |
|
|
|
@ -39,6 +43,9 @@ namespace eval punk::console {
|
|
|
|
|
tailcall disableRaw $channel |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
proc enableAnsi {} { |
|
|
|
|
#todo? |
|
|
|
|
} |
|
|
|
|
proc enableRaw {{channel stdin}} { |
|
|
|
|
set sttycmd [auto_execok stty] |
|
|
|
|
exec {*}$sttycmd raw -echo <@$channel |
|
|
|
@ -54,6 +61,9 @@ namespace eval punk::console {
|
|
|
|
|
if {$loadstate ni [list loading failed]} { |
|
|
|
|
package require twapi ;#should be fast once twapi dll loaded in zzzload thread |
|
|
|
|
set ::punk::console::has_twapi 1 |
|
|
|
|
proc enableAnsi {} { |
|
|
|
|
twapi::SetConsoleMode [twapi::get_console_handle stdout] 5 |
|
|
|
|
} |
|
|
|
|
proc enableRaw {{channel stdin}} { |
|
|
|
|
#review - change to modify_console_input_mode |
|
|
|
|
set console_handle [twapi::GetStdHandle -10] |
|
|
|
@ -71,6 +81,9 @@ namespace eval punk::console {
|
|
|
|
|
} else { |
|
|
|
|
if {$loadstate eq "failed"} { |
|
|
|
|
puts stderr "punk::console falling back to stty because twapi load failed" |
|
|
|
|
proc enableAnsi {} { |
|
|
|
|
puts stderr "punk::console::enableAnsi todo" |
|
|
|
|
} |
|
|
|
|
proc enableRaw {{channel stdin}} { |
|
|
|
|
set sttycmd [auto_execok stty] |
|
|
|
|
exec {*}$sttycmd raw -echo <@$channel |
|
|
|
|