diff --git a/src/modules/punk/console-999999.0a1.0.tm b/src/modules/punk/console-999999.0a1.0.tm index f1980ff3..375577a5 100644 --- a/src/modules/punk/console-999999.0a1.0.tm +++ b/src/modules/punk/console-999999.0a1.0.tm @@ -1522,7 +1522,7 @@ namespace eval punk::console { set pixeldict [punk::console::get_xterm_pixels $terminal] lassign $pixeldict _w sw _h sh if {[string is integer -strict $sw] && [string is integer -strict $sh]} { - lassign [punk::console::get_size] _cols columns _rows rows + lassign [punk::console::get_size $terminal] _cols columns _rows rows #review - is returned size in pixels always a multiple of rows and cols? set w [expr {$sw / $columns}] set h [expr {$sh / $rows}] @@ -1539,7 +1539,7 @@ namespace eval punk::console { #newsize supplied - try to set lassign [split [string tolower $newsize] x] w h if {![string is integer -strict $w] || ![string is integer -strict $h] || $w < 1 || $h < 1} { - error "punk::sixel::cell_size error - expected format WxH where W and H are positive integers - got '$newsize'" + error "punk::console::cell_size error - expected format WxH where W and H are positive integers - got '$newsize'" } set cell_size ${w}x${h} } @@ -2015,21 +2015,6 @@ namespace eval punk::console { } } error "chan configure method of getting console size not supported or failed to get valid size info" - - #we don't need to care about the input channel if chan configure on the output can give us the info. - #short circuit ansi cursor movement method if chan configure supports the -winsize value - set outconf [chan configure $out] - if {[dict exists $outconf -winsize]} { - #this mechanism is much faster than ansi cursor movements - #REVIEW check if any x-platform anomalies with this method? - #can -winsize key exist but contain erroneous info? We will check that we get 2 ints at least - lassign [dict get $outconf -winsize] cols lines - if {[string is integer -strict $cols] && [string is integer -strict $lines]} { - return [dict create columns $cols rows $lines] - } - #continue on to ansi mechanism if we didn't get 2 ints - } - } proc get_size_using_tput {{inoutchannels {stdin stdout}}} { @@ -2059,7 +2044,7 @@ namespace eval punk::console { #This issue also occurs when switching back from the alternate screen buffer - so perhaps that needs to be addressed elsewhere. puts -nonewline $out [punk::ansi::cursor_off][punk::ansi::move 2000 2000] lassign [get_cursor_pos_list $inoutchannels] lines cols - puts -nonewline $out [punk::ansi::move $start_row $start_col][punk::ansi::cursor_on];flush stdout + puts -nonewline $out [punk::ansi::move $start_row $start_col][punk::ansi::cursor_on];flush $out set result [dict create columns $cols rows $lines] } errM]} { puts -nonewline $out [punk::ansi::move $start_row $start_col] @@ -2365,7 +2350,7 @@ namespace eval punk::console { if {[dict exists $decmode_names $num_or_name]} { set m [dict get $decmode_names $num_or_name] } else { - error "punk::console::dec_get_mode unrecognised mode '$num_or_name'. Known mode names: [dict keys $decmode_names]" + error "punk::console::dec_has_mode unrecognised mode '$num_or_name'. Known mode names: [dict keys $decmode_names]" } } variable dec_has_mode_cache @@ -3300,7 +3285,7 @@ namespace eval punk::console { proc test_string_cursor {teststring {emit 0}} { variable ansi_available if {!$ansi_available} { - puts stderr "No ansi - cannot test char_width of '$teststring' returning [string length $test_string]" + puts stderr "No ansi - cannot test char_width of '$teststring' returning [string length $teststring]" return [string length $teststring] } punk::console::enable_alt_screen @@ -3337,7 +3322,7 @@ namespace eval punk::console { } flush stdout;#if we don't flush - a subsequent stderr write could move the cursor to a newline and interfere with our 2K1G erasure and cursor repositioning. punk::console::disable_alt_screen - return [list rowoffset [expr {$col2 - $col1}] columnoffset [expr {$row2 - $row1}]] + return [list rowoffset [expr {$row2 - $row1}] columnoffset [expr {$col2 - $col1}]] } #todo! - improve ideally we want to use VT sequences to determine - and make a separate utility for testing via systemcalls/os api @@ -3662,7 +3647,7 @@ namespace eval punk::console { if {!$is_vt52} { puts -nonewline stdout [punk::ansi::move_emit $row $col $data {*}$args] } else { - puts -nonewline stdout [punk::ansi::v52move_emit $row $col $data {*}$args] + puts -nonewline stdout [punk::ansi::vt52move_emit $row $col $data {*}$args] } } proc move_emit_return {row col data args} { @@ -3671,9 +3656,9 @@ namespace eval punk::console { lassign [punk::console::get_cursor_pos_list] orig_row orig_col set commands "" - append commands [punk::ansi::move_emit $row $col $data {*}$args] + append commands [punk::ansi::move_emit $row $col $data] foreach {row col data} $args { - append commands [punk::ansi::move_emit $row $col $data {*}$args] + append commands [punk::ansi::move_emit $row $col $data] } if {!$is_in_raw} { incr orig_row -1 @@ -4708,7 +4693,7 @@ namespace eval punk::console { proc enableAnsi {} { } #disableAnsi - proc enableAnsi {} { + proc disableAnsi {} { } #enableVirtualTerminal proc enableVirtualTerminal {{channels {input output}}} { diff --git a/src/modules/punk/console-buildversion.txt b/src/modules/punk/console-buildversion.txt index 9dc8240f..982309b3 100644 --- a/src/modules/punk/console-buildversion.txt +++ b/src/modules/punk/console-buildversion.txt @@ -1,6 +1,7 @@ -0.1.7 +0.1.8 #First line must be a semantic version number #all other lines are ignored. +#0.1.8 - bug fixes: disableAnsi was defined as a duplicate enableAnsi in the windows no-twapi branch; get_size_using_cursormove flushed stdout instead of the supplied output channel; removed unreachable code after error in get_size_using_chanconfigure; cell_size query path now passes its -console spec to get_size and error message names punk::console (was punk::sixel); test_string_cursor undefined $test_string reference and swapped rowoffset/columnoffset return labels; ansi::move_emit vt52 branch called nonexistent v52move_emit (now vt52move_emit); move_emit_return no longer re-expands args inside its per-triple loop (duplicated emissions); dec_has_mode unknown-mode error named dec_get_mode #0.1.7 - get_size dispatches object-governed calls through the virtual ::opunk::Console::size method (subclass overrides honoured); ANSI/tput mechanisms factored into size_via_query_mechanisms and registered as the class size_query_provider via ensure_object_integration; legacy channel path returns 80x24 instead of erroring when undetermined #0.1.6 - get_ansi_response_payload performs first-use active settling (with recursion latch) so all query paths pay one probe instead of a timeout per call on unsettled ambiguous consoles; default_console unifies the opunk::console probe-byte store with input_chunks_waiting #0.1.5 - settle_can_respond: layered active settling of console response capability (certainty/heuristic without emission, CSI 6n probe with timeout in the ambiguous zone); get_size triggers it at first use for anchored/default console specs; new variable can_respond_probe_timeout_ms