diff --git a/src/bootsupport/modules/punk-0.1.tm b/src/bootsupport/modules/punk-0.1.tm index 8f642653..6d181f27 100644 --- a/src/bootsupport/modules/punk-0.1.tm +++ b/src/bootsupport/modules/punk-0.1.tm @@ -6326,7 +6326,7 @@ namespace eval punk { lassign [dict values $argd] leaders opts values received set pathglobs [dict get $opts -pathglob] set binglobs [dict get $values binglob] - if {$::tcl_platform(platform) eq "windows"} { + if {$is_windows} { set sep ";" } else { # : ok for linux/bsd ... mac? @@ -6386,6 +6386,7 @@ namespace eval punk { #Sometimes PATHEXT includes an entry of just a dot - which means files with no extension are considered executable. #We need to account for this in our glob pattern. set pathexts [list] + #review - we assume this is only relevant on windows for now. if {[info exists ::env(PATHEXT)]} { set env_pathexts [split $::env(PATHEXT) ";"] #set pathexts [lmap e $env_pathexts {string tolower $e}] @@ -6442,7 +6443,7 @@ namespace eval punk { set d_index_executables [dict create] ;#key is path index, value is list of executables in that path set path_idx 0 foreach p $all_paths { - if {$::tcl_platform(platform) eq "windows"} { + if {$is_windows} { set pnorm [string tolower $p] } else { set pnorm $p @@ -6461,7 +6462,7 @@ namespace eval punk { #If we don't normalize the path here - then trailing backslashes on windows can cause a problem with the -tail glob returning a leading slash on the executable names. #also as we don't necessarily normalize the resulting final path with executable - we want the case to be correct. set pnormglob [file normalize $p] - if {$::tcl_platform(platform) eq "windows"} { + if {$is_windows} { #TCL's glob on windows is case-insensitive, but in some cases return the result with the case as globbed for regardless of the actual case on the filesystem. #(This seems to occur when the pattern does *not* contain a wildcard and is probably a bug) @@ -6501,7 +6502,7 @@ namespace eval punk { dict set d_index_executables $path_idx $executables foreach exe $executables { #todo - other case-insensitive platforms/filesystems. - if {$::tcl_platform(platform) eq "windows"} { + if {$is_windows} { set exe_key [string tolower $exe] } else { #on case @@ -6533,7 +6534,7 @@ namespace eval punk { #However we do need to add the path index to the path_indices for each executable that is found in this path - as this will affect which paths are shown as overshadowing which executables. set executables [dict get $d_index_executables [lindex [dict get $d_path_info $pnorm indices] 0]] ;#get executables for this path foreach exe $executables { - if {$::tcl_platform(platform) eq "windows"} { + if {$is_windows} { set exe_key [string tolower $exe] } else { set exe_key $exe @@ -6596,7 +6597,11 @@ namespace eval punk { # continue #} set thisrow [list $pidx] - set pnorm [string tolower $p] + if {$is_windows} { + set pnorm [string tolower $p] + } else { + set pnorm $p + } if {[string length $pnorm] > 1} { set lastchar [string index $pnorm end] if {$lastchar eq "/" || $lastchar eq "\\"} { @@ -6617,15 +6622,28 @@ namespace eval punk { set display_executables [list] foreach exe $executables { set matched_binglob 0 - foreach bg $binglobs { - #review - -nocase only on case-insensitive platforms/filesystems? - #- but it is simpler to just apply it to all platforms here rather than trying to determine case-sensitivity of each path. - if {[string match -nocase $bg $exe]} { - set matched_binglob 1 - continue + if {$is_windows} { + foreach bg $binglobs { + #review - -nocase only on case-insensitive platforms/filesystems? + #todo - mac has case-insensitive filesystem by default. + if {[string match -nocase $bg $exe]} { + set matched_binglob 1 + continue + } + } + } else { + foreach bg $binglobs { + if {[string match $bg $exe]} { + set matched_binglob 1 + continue + } } } - set exe_key [string tolower $exe] + if {$is_windows} { + set exe_key [string tolower $exe] + } else { + set exe_key $exe + } if {[dict exists $d_bin_info $exe_key]} { set bindata [dict get $d_bin_info $exe_key] set path_indices [dict get $bindata path_indices] @@ -6738,7 +6756,11 @@ namespace eval punk { set executables [dict get $d_index_executables $original_path_idx] lappend thisrow [llength $executables] foreach exe $executables { - set exe_key [string tolower $exe] + if {$is_windows} { + set exe_key [string tolower $exe] + } else { + set exe_key $exe + } if {[dict exists $d_bin_info $exe_key]} { set bindata [dict get $d_bin_info $exe_key] set path_indices [dict get $bindata path_indices] diff --git a/src/bootsupport/modules/punk/console-0.1.1.tm b/src/bootsupport/modules/punk/console-0.1.1.tm index 73d3555d..71206726 100644 --- a/src/bootsupport/modules/punk/console-0.1.1.tm +++ b/src/bootsupport/modules/punk/console-0.1.1.tm @@ -3634,7 +3634,7 @@ namespace eval punk::console::system { catch { chan configure stdin -inputmode raw } - puts "enableRaw_stty previous_stty_state_$channel: [set previous_stty_state_$channel]" + #puts "enableRaw_stty previous_stty_state_$channel: [set previous_stty_state_$channel]" return [dict create previous [set previous_stty_state_$channel]] } proc disableRaw_stty {{channel stdin}} { diff --git a/src/bootsupport/modules/textblock-0.1.3.tm b/src/bootsupport/modules/textblock-0.1.3.tm index 996524e4..07bce319 100644 --- a/src/bootsupport/modules/textblock-0.1.3.tm +++ b/src/bootsupport/modules/textblock-0.1.3.tm @@ -5751,8 +5751,13 @@ tcl::namespace::eval textblock { "Join blocks of text line by line but don't add padding on each line to enforce uniform width. Already uniform blocks will join faster than textblock::join, and ragged blocks will join in a ragged manner. - see also textblock::join_basic_raw - a thin wrapper around split and join for the common case of joining blocks without any options, - and is intended to avoid the overhead of argument parsing. + see also textblock::join_basic_raw - a thin wrapper around split and join, but with ansireplays, for the common case of joining blocks + without any options, and is intended to avoid the minor additional overhead of argument parsing. + + For both, -ansireplays is always on (if ansi detected) and -ansiresets defaults to auto which means we will add resets at the start + and end of each line if we detect any ansi codes in the block, but won't add them if we don't detect any ansi codes in the block. + This is because joined blocks often have adjacent lines with no padding between them, so without resets at line extremes + - trailing ansi from one block's line can easily affect the corresponding line in the next block. " -ansiresets -type any -default auto -- -type none -optional 0 -help "end of options marker -- is mandatory because joined blocks may easily conflict with flags" @@ -5804,8 +5809,11 @@ tcl::namespace::eval textblock { "Join blocks of text line by line but don't add padding on each line to enforce uniform width. Already uniform blocks will join faster than textblock::join, and ragged blocks will join in a ragged manner. - This version is a thin wrapper around split and join for the common case of joining blocks without any options, - and is intended to avoid the overhead of argument parsing. + This version is a thin wrapper around split and join, but with ansireplays, for the common case of joining blocks without + any options, and is intended to avoid the minor additional overhead of argument parsing. + + The performance is dominated by the ansireplays processing when ansi is detected, and this will be the same for + textblock::join_basic, textblock::join_basic_raw and textblock::join. " @values blocks -type any -multiple 1 diff --git a/src/modules/punk-0.1.tm b/src/modules/punk-0.1.tm index 8f642653..6d181f27 100644 --- a/src/modules/punk-0.1.tm +++ b/src/modules/punk-0.1.tm @@ -6326,7 +6326,7 @@ namespace eval punk { lassign [dict values $argd] leaders opts values received set pathglobs [dict get $opts -pathglob] set binglobs [dict get $values binglob] - if {$::tcl_platform(platform) eq "windows"} { + if {$is_windows} { set sep ";" } else { # : ok for linux/bsd ... mac? @@ -6386,6 +6386,7 @@ namespace eval punk { #Sometimes PATHEXT includes an entry of just a dot - which means files with no extension are considered executable. #We need to account for this in our glob pattern. set pathexts [list] + #review - we assume this is only relevant on windows for now. if {[info exists ::env(PATHEXT)]} { set env_pathexts [split $::env(PATHEXT) ";"] #set pathexts [lmap e $env_pathexts {string tolower $e}] @@ -6442,7 +6443,7 @@ namespace eval punk { set d_index_executables [dict create] ;#key is path index, value is list of executables in that path set path_idx 0 foreach p $all_paths { - if {$::tcl_platform(platform) eq "windows"} { + if {$is_windows} { set pnorm [string tolower $p] } else { set pnorm $p @@ -6461,7 +6462,7 @@ namespace eval punk { #If we don't normalize the path here - then trailing backslashes on windows can cause a problem with the -tail glob returning a leading slash on the executable names. #also as we don't necessarily normalize the resulting final path with executable - we want the case to be correct. set pnormglob [file normalize $p] - if {$::tcl_platform(platform) eq "windows"} { + if {$is_windows} { #TCL's glob on windows is case-insensitive, but in some cases return the result with the case as globbed for regardless of the actual case on the filesystem. #(This seems to occur when the pattern does *not* contain a wildcard and is probably a bug) @@ -6501,7 +6502,7 @@ namespace eval punk { dict set d_index_executables $path_idx $executables foreach exe $executables { #todo - other case-insensitive platforms/filesystems. - if {$::tcl_platform(platform) eq "windows"} { + if {$is_windows} { set exe_key [string tolower $exe] } else { #on case @@ -6533,7 +6534,7 @@ namespace eval punk { #However we do need to add the path index to the path_indices for each executable that is found in this path - as this will affect which paths are shown as overshadowing which executables. set executables [dict get $d_index_executables [lindex [dict get $d_path_info $pnorm indices] 0]] ;#get executables for this path foreach exe $executables { - if {$::tcl_platform(platform) eq "windows"} { + if {$is_windows} { set exe_key [string tolower $exe] } else { set exe_key $exe @@ -6596,7 +6597,11 @@ namespace eval punk { # continue #} set thisrow [list $pidx] - set pnorm [string tolower $p] + if {$is_windows} { + set pnorm [string tolower $p] + } else { + set pnorm $p + } if {[string length $pnorm] > 1} { set lastchar [string index $pnorm end] if {$lastchar eq "/" || $lastchar eq "\\"} { @@ -6617,15 +6622,28 @@ namespace eval punk { set display_executables [list] foreach exe $executables { set matched_binglob 0 - foreach bg $binglobs { - #review - -nocase only on case-insensitive platforms/filesystems? - #- but it is simpler to just apply it to all platforms here rather than trying to determine case-sensitivity of each path. - if {[string match -nocase $bg $exe]} { - set matched_binglob 1 - continue + if {$is_windows} { + foreach bg $binglobs { + #review - -nocase only on case-insensitive platforms/filesystems? + #todo - mac has case-insensitive filesystem by default. + if {[string match -nocase $bg $exe]} { + set matched_binglob 1 + continue + } + } + } else { + foreach bg $binglobs { + if {[string match $bg $exe]} { + set matched_binglob 1 + continue + } } } - set exe_key [string tolower $exe] + if {$is_windows} { + set exe_key [string tolower $exe] + } else { + set exe_key $exe + } if {[dict exists $d_bin_info $exe_key]} { set bindata [dict get $d_bin_info $exe_key] set path_indices [dict get $bindata path_indices] @@ -6738,7 +6756,11 @@ namespace eval punk { set executables [dict get $d_index_executables $original_path_idx] lappend thisrow [llength $executables] foreach exe $executables { - set exe_key [string tolower $exe] + if {$is_windows} { + set exe_key [string tolower $exe] + } else { + set exe_key $exe + } if {[dict exists $d_bin_info $exe_key]} { set bindata [dict get $d_bin_info $exe_key] set path_indices [dict get $bindata path_indices] diff --git a/src/modules/punk/console-999999.0a1.0.tm b/src/modules/punk/console-999999.0a1.0.tm index b49ca08a..d7d873e2 100644 --- a/src/modules/punk/console-999999.0a1.0.tm +++ b/src/modules/punk/console-999999.0a1.0.tm @@ -3634,7 +3634,7 @@ namespace eval punk::console::system { catch { chan configure stdin -inputmode raw } - puts "enableRaw_stty previous_stty_state_$channel: [set previous_stty_state_$channel]" + #puts "enableRaw_stty previous_stty_state_$channel: [set previous_stty_state_$channel]" return [dict create previous [set previous_stty_state_$channel]] } proc disableRaw_stty {{channel stdin}} { diff --git a/src/modules/textblock-999999.0a1.0.tm b/src/modules/textblock-999999.0a1.0.tm index 65e05925..5766a19b 100644 --- a/src/modules/textblock-999999.0a1.0.tm +++ b/src/modules/textblock-999999.0a1.0.tm @@ -5751,8 +5751,13 @@ tcl::namespace::eval textblock { "Join blocks of text line by line but don't add padding on each line to enforce uniform width. Already uniform blocks will join faster than textblock::join, and ragged blocks will join in a ragged manner. - see also textblock::join_basic_raw - a thin wrapper around split and join for the common case of joining blocks without any options, - and is intended to avoid the overhead of argument parsing. + see also textblock::join_basic_raw - a thin wrapper around split and join, but with ansireplays, for the common case of joining blocks + without any options, and is intended to avoid the minor additional overhead of argument parsing. + + For both, -ansireplays is always on (if ansi detected) and -ansiresets defaults to auto which means we will add resets at the start + and end of each line if we detect any ansi codes in the block, but won't add them if we don't detect any ansi codes in the block. + This is because joined blocks often have adjacent lines with no padding between them, so without resets at line extremes + - trailing ansi from one block's line can easily affect the corresponding line in the next block. " -ansiresets -type any -default auto -- -type none -optional 0 -help "end of options marker -- is mandatory because joined blocks may easily conflict with flags" @@ -5804,8 +5809,11 @@ tcl::namespace::eval textblock { "Join blocks of text line by line but don't add padding on each line to enforce uniform width. Already uniform blocks will join faster than textblock::join, and ragged blocks will join in a ragged manner. - This version is a thin wrapper around split and join for the common case of joining blocks without any options, - and is intended to avoid the overhead of argument parsing. + This version is a thin wrapper around split and join, but with ansireplays, for the common case of joining blocks without + any options, and is intended to avoid the minor additional overhead of argument parsing. + + The performance is dominated by the ansireplays processing when ansi is detected, and this will be the same for + textblock::join_basic, textblock::join_basic_raw and textblock::join. " @values blocks -type any -multiple 1 diff --git a/src/project_layouts/custom/_project/punk.project-0.1/src/bootsupport/modules/punk-0.1.tm b/src/project_layouts/custom/_project/punk.project-0.1/src/bootsupport/modules/punk-0.1.tm index 8f642653..6d181f27 100644 --- a/src/project_layouts/custom/_project/punk.project-0.1/src/bootsupport/modules/punk-0.1.tm +++ b/src/project_layouts/custom/_project/punk.project-0.1/src/bootsupport/modules/punk-0.1.tm @@ -6326,7 +6326,7 @@ namespace eval punk { lassign [dict values $argd] leaders opts values received set pathglobs [dict get $opts -pathglob] set binglobs [dict get $values binglob] - if {$::tcl_platform(platform) eq "windows"} { + if {$is_windows} { set sep ";" } else { # : ok for linux/bsd ... mac? @@ -6386,6 +6386,7 @@ namespace eval punk { #Sometimes PATHEXT includes an entry of just a dot - which means files with no extension are considered executable. #We need to account for this in our glob pattern. set pathexts [list] + #review - we assume this is only relevant on windows for now. if {[info exists ::env(PATHEXT)]} { set env_pathexts [split $::env(PATHEXT) ";"] #set pathexts [lmap e $env_pathexts {string tolower $e}] @@ -6442,7 +6443,7 @@ namespace eval punk { set d_index_executables [dict create] ;#key is path index, value is list of executables in that path set path_idx 0 foreach p $all_paths { - if {$::tcl_platform(platform) eq "windows"} { + if {$is_windows} { set pnorm [string tolower $p] } else { set pnorm $p @@ -6461,7 +6462,7 @@ namespace eval punk { #If we don't normalize the path here - then trailing backslashes on windows can cause a problem with the -tail glob returning a leading slash on the executable names. #also as we don't necessarily normalize the resulting final path with executable - we want the case to be correct. set pnormglob [file normalize $p] - if {$::tcl_platform(platform) eq "windows"} { + if {$is_windows} { #TCL's glob on windows is case-insensitive, but in some cases return the result with the case as globbed for regardless of the actual case on the filesystem. #(This seems to occur when the pattern does *not* contain a wildcard and is probably a bug) @@ -6501,7 +6502,7 @@ namespace eval punk { dict set d_index_executables $path_idx $executables foreach exe $executables { #todo - other case-insensitive platforms/filesystems. - if {$::tcl_platform(platform) eq "windows"} { + if {$is_windows} { set exe_key [string tolower $exe] } else { #on case @@ -6533,7 +6534,7 @@ namespace eval punk { #However we do need to add the path index to the path_indices for each executable that is found in this path - as this will affect which paths are shown as overshadowing which executables. set executables [dict get $d_index_executables [lindex [dict get $d_path_info $pnorm indices] 0]] ;#get executables for this path foreach exe $executables { - if {$::tcl_platform(platform) eq "windows"} { + if {$is_windows} { set exe_key [string tolower $exe] } else { set exe_key $exe @@ -6596,7 +6597,11 @@ namespace eval punk { # continue #} set thisrow [list $pidx] - set pnorm [string tolower $p] + if {$is_windows} { + set pnorm [string tolower $p] + } else { + set pnorm $p + } if {[string length $pnorm] > 1} { set lastchar [string index $pnorm end] if {$lastchar eq "/" || $lastchar eq "\\"} { @@ -6617,15 +6622,28 @@ namespace eval punk { set display_executables [list] foreach exe $executables { set matched_binglob 0 - foreach bg $binglobs { - #review - -nocase only on case-insensitive platforms/filesystems? - #- but it is simpler to just apply it to all platforms here rather than trying to determine case-sensitivity of each path. - if {[string match -nocase $bg $exe]} { - set matched_binglob 1 - continue + if {$is_windows} { + foreach bg $binglobs { + #review - -nocase only on case-insensitive platforms/filesystems? + #todo - mac has case-insensitive filesystem by default. + if {[string match -nocase $bg $exe]} { + set matched_binglob 1 + continue + } + } + } else { + foreach bg $binglobs { + if {[string match $bg $exe]} { + set matched_binglob 1 + continue + } } } - set exe_key [string tolower $exe] + if {$is_windows} { + set exe_key [string tolower $exe] + } else { + set exe_key $exe + } if {[dict exists $d_bin_info $exe_key]} { set bindata [dict get $d_bin_info $exe_key] set path_indices [dict get $bindata path_indices] @@ -6738,7 +6756,11 @@ namespace eval punk { set executables [dict get $d_index_executables $original_path_idx] lappend thisrow [llength $executables] foreach exe $executables { - set exe_key [string tolower $exe] + if {$is_windows} { + set exe_key [string tolower $exe] + } else { + set exe_key $exe + } if {[dict exists $d_bin_info $exe_key]} { set bindata [dict get $d_bin_info $exe_key] set path_indices [dict get $bindata path_indices] diff --git a/src/project_layouts/custom/_project/punk.project-0.1/src/bootsupport/modules/punk/console-0.1.1.tm b/src/project_layouts/custom/_project/punk.project-0.1/src/bootsupport/modules/punk/console-0.1.1.tm index 73d3555d..71206726 100644 --- a/src/project_layouts/custom/_project/punk.project-0.1/src/bootsupport/modules/punk/console-0.1.1.tm +++ b/src/project_layouts/custom/_project/punk.project-0.1/src/bootsupport/modules/punk/console-0.1.1.tm @@ -3634,7 +3634,7 @@ namespace eval punk::console::system { catch { chan configure stdin -inputmode raw } - puts "enableRaw_stty previous_stty_state_$channel: [set previous_stty_state_$channel]" + #puts "enableRaw_stty previous_stty_state_$channel: [set previous_stty_state_$channel]" return [dict create previous [set previous_stty_state_$channel]] } proc disableRaw_stty {{channel stdin}} { diff --git a/src/project_layouts/custom/_project/punk.project-0.1/src/bootsupport/modules/textblock-0.1.3.tm b/src/project_layouts/custom/_project/punk.project-0.1/src/bootsupport/modules/textblock-0.1.3.tm index 996524e4..07bce319 100644 --- a/src/project_layouts/custom/_project/punk.project-0.1/src/bootsupport/modules/textblock-0.1.3.tm +++ b/src/project_layouts/custom/_project/punk.project-0.1/src/bootsupport/modules/textblock-0.1.3.tm @@ -5751,8 +5751,13 @@ tcl::namespace::eval textblock { "Join blocks of text line by line but don't add padding on each line to enforce uniform width. Already uniform blocks will join faster than textblock::join, and ragged blocks will join in a ragged manner. - see also textblock::join_basic_raw - a thin wrapper around split and join for the common case of joining blocks without any options, - and is intended to avoid the overhead of argument parsing. + see also textblock::join_basic_raw - a thin wrapper around split and join, but with ansireplays, for the common case of joining blocks + without any options, and is intended to avoid the minor additional overhead of argument parsing. + + For both, -ansireplays is always on (if ansi detected) and -ansiresets defaults to auto which means we will add resets at the start + and end of each line if we detect any ansi codes in the block, but won't add them if we don't detect any ansi codes in the block. + This is because joined blocks often have adjacent lines with no padding between them, so without resets at line extremes + - trailing ansi from one block's line can easily affect the corresponding line in the next block. " -ansiresets -type any -default auto -- -type none -optional 0 -help "end of options marker -- is mandatory because joined blocks may easily conflict with flags" @@ -5804,8 +5809,11 @@ tcl::namespace::eval textblock { "Join blocks of text line by line but don't add padding on each line to enforce uniform width. Already uniform blocks will join faster than textblock::join, and ragged blocks will join in a ragged manner. - This version is a thin wrapper around split and join for the common case of joining blocks without any options, - and is intended to avoid the overhead of argument parsing. + This version is a thin wrapper around split and join, but with ansireplays, for the common case of joining blocks without + any options, and is intended to avoid the minor additional overhead of argument parsing. + + The performance is dominated by the ansireplays processing when ansi is detected, and this will be the same for + textblock::join_basic, textblock::join_basic_raw and textblock::join. " @values blocks -type any -multiple 1 diff --git a/src/project_layouts/custom/_project/punk.shell-0.1/src/bootsupport/modules/punk-0.1.tm b/src/project_layouts/custom/_project/punk.shell-0.1/src/bootsupport/modules/punk-0.1.tm index 8f642653..6d181f27 100644 --- a/src/project_layouts/custom/_project/punk.shell-0.1/src/bootsupport/modules/punk-0.1.tm +++ b/src/project_layouts/custom/_project/punk.shell-0.1/src/bootsupport/modules/punk-0.1.tm @@ -6326,7 +6326,7 @@ namespace eval punk { lassign [dict values $argd] leaders opts values received set pathglobs [dict get $opts -pathglob] set binglobs [dict get $values binglob] - if {$::tcl_platform(platform) eq "windows"} { + if {$is_windows} { set sep ";" } else { # : ok for linux/bsd ... mac? @@ -6386,6 +6386,7 @@ namespace eval punk { #Sometimes PATHEXT includes an entry of just a dot - which means files with no extension are considered executable. #We need to account for this in our glob pattern. set pathexts [list] + #review - we assume this is only relevant on windows for now. if {[info exists ::env(PATHEXT)]} { set env_pathexts [split $::env(PATHEXT) ";"] #set pathexts [lmap e $env_pathexts {string tolower $e}] @@ -6442,7 +6443,7 @@ namespace eval punk { set d_index_executables [dict create] ;#key is path index, value is list of executables in that path set path_idx 0 foreach p $all_paths { - if {$::tcl_platform(platform) eq "windows"} { + if {$is_windows} { set pnorm [string tolower $p] } else { set pnorm $p @@ -6461,7 +6462,7 @@ namespace eval punk { #If we don't normalize the path here - then trailing backslashes on windows can cause a problem with the -tail glob returning a leading slash on the executable names. #also as we don't necessarily normalize the resulting final path with executable - we want the case to be correct. set pnormglob [file normalize $p] - if {$::tcl_platform(platform) eq "windows"} { + if {$is_windows} { #TCL's glob on windows is case-insensitive, but in some cases return the result with the case as globbed for regardless of the actual case on the filesystem. #(This seems to occur when the pattern does *not* contain a wildcard and is probably a bug) @@ -6501,7 +6502,7 @@ namespace eval punk { dict set d_index_executables $path_idx $executables foreach exe $executables { #todo - other case-insensitive platforms/filesystems. - if {$::tcl_platform(platform) eq "windows"} { + if {$is_windows} { set exe_key [string tolower $exe] } else { #on case @@ -6533,7 +6534,7 @@ namespace eval punk { #However we do need to add the path index to the path_indices for each executable that is found in this path - as this will affect which paths are shown as overshadowing which executables. set executables [dict get $d_index_executables [lindex [dict get $d_path_info $pnorm indices] 0]] ;#get executables for this path foreach exe $executables { - if {$::tcl_platform(platform) eq "windows"} { + if {$is_windows} { set exe_key [string tolower $exe] } else { set exe_key $exe @@ -6596,7 +6597,11 @@ namespace eval punk { # continue #} set thisrow [list $pidx] - set pnorm [string tolower $p] + if {$is_windows} { + set pnorm [string tolower $p] + } else { + set pnorm $p + } if {[string length $pnorm] > 1} { set lastchar [string index $pnorm end] if {$lastchar eq "/" || $lastchar eq "\\"} { @@ -6617,15 +6622,28 @@ namespace eval punk { set display_executables [list] foreach exe $executables { set matched_binglob 0 - foreach bg $binglobs { - #review - -nocase only on case-insensitive platforms/filesystems? - #- but it is simpler to just apply it to all platforms here rather than trying to determine case-sensitivity of each path. - if {[string match -nocase $bg $exe]} { - set matched_binglob 1 - continue + if {$is_windows} { + foreach bg $binglobs { + #review - -nocase only on case-insensitive platforms/filesystems? + #todo - mac has case-insensitive filesystem by default. + if {[string match -nocase $bg $exe]} { + set matched_binglob 1 + continue + } + } + } else { + foreach bg $binglobs { + if {[string match $bg $exe]} { + set matched_binglob 1 + continue + } } } - set exe_key [string tolower $exe] + if {$is_windows} { + set exe_key [string tolower $exe] + } else { + set exe_key $exe + } if {[dict exists $d_bin_info $exe_key]} { set bindata [dict get $d_bin_info $exe_key] set path_indices [dict get $bindata path_indices] @@ -6738,7 +6756,11 @@ namespace eval punk { set executables [dict get $d_index_executables $original_path_idx] lappend thisrow [llength $executables] foreach exe $executables { - set exe_key [string tolower $exe] + if {$is_windows} { + set exe_key [string tolower $exe] + } else { + set exe_key $exe + } if {[dict exists $d_bin_info $exe_key]} { set bindata [dict get $d_bin_info $exe_key] set path_indices [dict get $bindata path_indices] diff --git a/src/project_layouts/custom/_project/punk.shell-0.1/src/bootsupport/modules/punk/console-0.1.1.tm b/src/project_layouts/custom/_project/punk.shell-0.1/src/bootsupport/modules/punk/console-0.1.1.tm index 73d3555d..71206726 100644 --- a/src/project_layouts/custom/_project/punk.shell-0.1/src/bootsupport/modules/punk/console-0.1.1.tm +++ b/src/project_layouts/custom/_project/punk.shell-0.1/src/bootsupport/modules/punk/console-0.1.1.tm @@ -3634,7 +3634,7 @@ namespace eval punk::console::system { catch { chan configure stdin -inputmode raw } - puts "enableRaw_stty previous_stty_state_$channel: [set previous_stty_state_$channel]" + #puts "enableRaw_stty previous_stty_state_$channel: [set previous_stty_state_$channel]" return [dict create previous [set previous_stty_state_$channel]] } proc disableRaw_stty {{channel stdin}} { diff --git a/src/project_layouts/custom/_project/punk.shell-0.1/src/bootsupport/modules/textblock-0.1.3.tm b/src/project_layouts/custom/_project/punk.shell-0.1/src/bootsupport/modules/textblock-0.1.3.tm index 996524e4..07bce319 100644 --- a/src/project_layouts/custom/_project/punk.shell-0.1/src/bootsupport/modules/textblock-0.1.3.tm +++ b/src/project_layouts/custom/_project/punk.shell-0.1/src/bootsupport/modules/textblock-0.1.3.tm @@ -5751,8 +5751,13 @@ tcl::namespace::eval textblock { "Join blocks of text line by line but don't add padding on each line to enforce uniform width. Already uniform blocks will join faster than textblock::join, and ragged blocks will join in a ragged manner. - see also textblock::join_basic_raw - a thin wrapper around split and join for the common case of joining blocks without any options, - and is intended to avoid the overhead of argument parsing. + see also textblock::join_basic_raw - a thin wrapper around split and join, but with ansireplays, for the common case of joining blocks + without any options, and is intended to avoid the minor additional overhead of argument parsing. + + For both, -ansireplays is always on (if ansi detected) and -ansiresets defaults to auto which means we will add resets at the start + and end of each line if we detect any ansi codes in the block, but won't add them if we don't detect any ansi codes in the block. + This is because joined blocks often have adjacent lines with no padding between them, so without resets at line extremes + - trailing ansi from one block's line can easily affect the corresponding line in the next block. " -ansiresets -type any -default auto -- -type none -optional 0 -help "end of options marker -- is mandatory because joined blocks may easily conflict with flags" @@ -5804,8 +5809,11 @@ tcl::namespace::eval textblock { "Join blocks of text line by line but don't add padding on each line to enforce uniform width. Already uniform blocks will join faster than textblock::join, and ragged blocks will join in a ragged manner. - This version is a thin wrapper around split and join for the common case of joining blocks without any options, - and is intended to avoid the overhead of argument parsing. + This version is a thin wrapper around split and join, but with ansireplays, for the common case of joining blocks without + any options, and is intended to avoid the minor additional overhead of argument parsing. + + The performance is dominated by the ansireplays processing when ansi is detected, and this will be the same for + textblock::join_basic, textblock::join_basic_raw and textblock::join. " @values blocks -type any -multiple 1 diff --git a/src/vfs/_vfscommon.vfs/modules/punk-0.1.tm b/src/vfs/_vfscommon.vfs/modules/punk-0.1.tm index 8f642653..6d181f27 100644 --- a/src/vfs/_vfscommon.vfs/modules/punk-0.1.tm +++ b/src/vfs/_vfscommon.vfs/modules/punk-0.1.tm @@ -6326,7 +6326,7 @@ namespace eval punk { lassign [dict values $argd] leaders opts values received set pathglobs [dict get $opts -pathglob] set binglobs [dict get $values binglob] - if {$::tcl_platform(platform) eq "windows"} { + if {$is_windows} { set sep ";" } else { # : ok for linux/bsd ... mac? @@ -6386,6 +6386,7 @@ namespace eval punk { #Sometimes PATHEXT includes an entry of just a dot - which means files with no extension are considered executable. #We need to account for this in our glob pattern. set pathexts [list] + #review - we assume this is only relevant on windows for now. if {[info exists ::env(PATHEXT)]} { set env_pathexts [split $::env(PATHEXT) ";"] #set pathexts [lmap e $env_pathexts {string tolower $e}] @@ -6442,7 +6443,7 @@ namespace eval punk { set d_index_executables [dict create] ;#key is path index, value is list of executables in that path set path_idx 0 foreach p $all_paths { - if {$::tcl_platform(platform) eq "windows"} { + if {$is_windows} { set pnorm [string tolower $p] } else { set pnorm $p @@ -6461,7 +6462,7 @@ namespace eval punk { #If we don't normalize the path here - then trailing backslashes on windows can cause a problem with the -tail glob returning a leading slash on the executable names. #also as we don't necessarily normalize the resulting final path with executable - we want the case to be correct. set pnormglob [file normalize $p] - if {$::tcl_platform(platform) eq "windows"} { + if {$is_windows} { #TCL's glob on windows is case-insensitive, but in some cases return the result with the case as globbed for regardless of the actual case on the filesystem. #(This seems to occur when the pattern does *not* contain a wildcard and is probably a bug) @@ -6501,7 +6502,7 @@ namespace eval punk { dict set d_index_executables $path_idx $executables foreach exe $executables { #todo - other case-insensitive platforms/filesystems. - if {$::tcl_platform(platform) eq "windows"} { + if {$is_windows} { set exe_key [string tolower $exe] } else { #on case @@ -6533,7 +6534,7 @@ namespace eval punk { #However we do need to add the path index to the path_indices for each executable that is found in this path - as this will affect which paths are shown as overshadowing which executables. set executables [dict get $d_index_executables [lindex [dict get $d_path_info $pnorm indices] 0]] ;#get executables for this path foreach exe $executables { - if {$::tcl_platform(platform) eq "windows"} { + if {$is_windows} { set exe_key [string tolower $exe] } else { set exe_key $exe @@ -6596,7 +6597,11 @@ namespace eval punk { # continue #} set thisrow [list $pidx] - set pnorm [string tolower $p] + if {$is_windows} { + set pnorm [string tolower $p] + } else { + set pnorm $p + } if {[string length $pnorm] > 1} { set lastchar [string index $pnorm end] if {$lastchar eq "/" || $lastchar eq "\\"} { @@ -6617,15 +6622,28 @@ namespace eval punk { set display_executables [list] foreach exe $executables { set matched_binglob 0 - foreach bg $binglobs { - #review - -nocase only on case-insensitive platforms/filesystems? - #- but it is simpler to just apply it to all platforms here rather than trying to determine case-sensitivity of each path. - if {[string match -nocase $bg $exe]} { - set matched_binglob 1 - continue + if {$is_windows} { + foreach bg $binglobs { + #review - -nocase only on case-insensitive platforms/filesystems? + #todo - mac has case-insensitive filesystem by default. + if {[string match -nocase $bg $exe]} { + set matched_binglob 1 + continue + } + } + } else { + foreach bg $binglobs { + if {[string match $bg $exe]} { + set matched_binglob 1 + continue + } } } - set exe_key [string tolower $exe] + if {$is_windows} { + set exe_key [string tolower $exe] + } else { + set exe_key $exe + } if {[dict exists $d_bin_info $exe_key]} { set bindata [dict get $d_bin_info $exe_key] set path_indices [dict get $bindata path_indices] @@ -6738,7 +6756,11 @@ namespace eval punk { set executables [dict get $d_index_executables $original_path_idx] lappend thisrow [llength $executables] foreach exe $executables { - set exe_key [string tolower $exe] + if {$is_windows} { + set exe_key [string tolower $exe] + } else { + set exe_key $exe + } if {[dict exists $d_bin_info $exe_key]} { set bindata [dict get $d_bin_info $exe_key] set path_indices [dict get $bindata path_indices] diff --git a/src/vfs/_vfscommon.vfs/modules/punk/console-0.1.1.tm b/src/vfs/_vfscommon.vfs/modules/punk/console-0.1.1.tm index 73d3555d..71206726 100644 --- a/src/vfs/_vfscommon.vfs/modules/punk/console-0.1.1.tm +++ b/src/vfs/_vfscommon.vfs/modules/punk/console-0.1.1.tm @@ -3634,7 +3634,7 @@ namespace eval punk::console::system { catch { chan configure stdin -inputmode raw } - puts "enableRaw_stty previous_stty_state_$channel: [set previous_stty_state_$channel]" + #puts "enableRaw_stty previous_stty_state_$channel: [set previous_stty_state_$channel]" return [dict create previous [set previous_stty_state_$channel]] } proc disableRaw_stty {{channel stdin}} { diff --git a/src/vfs/_vfscommon.vfs/modules/textblock-0.1.3.tm b/src/vfs/_vfscommon.vfs/modules/textblock-0.1.3.tm index 996524e4..07bce319 100644 --- a/src/vfs/_vfscommon.vfs/modules/textblock-0.1.3.tm +++ b/src/vfs/_vfscommon.vfs/modules/textblock-0.1.3.tm @@ -5751,8 +5751,13 @@ tcl::namespace::eval textblock { "Join blocks of text line by line but don't add padding on each line to enforce uniform width. Already uniform blocks will join faster than textblock::join, and ragged blocks will join in a ragged manner. - see also textblock::join_basic_raw - a thin wrapper around split and join for the common case of joining blocks without any options, - and is intended to avoid the overhead of argument parsing. + see also textblock::join_basic_raw - a thin wrapper around split and join, but with ansireplays, for the common case of joining blocks + without any options, and is intended to avoid the minor additional overhead of argument parsing. + + For both, -ansireplays is always on (if ansi detected) and -ansiresets defaults to auto which means we will add resets at the start + and end of each line if we detect any ansi codes in the block, but won't add them if we don't detect any ansi codes in the block. + This is because joined blocks often have adjacent lines with no padding between them, so without resets at line extremes + - trailing ansi from one block's line can easily affect the corresponding line in the next block. " -ansiresets -type any -default auto -- -type none -optional 0 -help "end of options marker -- is mandatory because joined blocks may easily conflict with flags" @@ -5804,8 +5809,11 @@ tcl::namespace::eval textblock { "Join blocks of text line by line but don't add padding on each line to enforce uniform width. Already uniform blocks will join faster than textblock::join, and ragged blocks will join in a ragged manner. - This version is a thin wrapper around split and join for the common case of joining blocks without any options, - and is intended to avoid the overhead of argument parsing. + This version is a thin wrapper around split and join, but with ansireplays, for the common case of joining blocks without + any options, and is intended to avoid the minor additional overhead of argument parsing. + + The performance is dominated by the ansireplays processing when ansi is detected, and this will be the same for + textblock::join_basic, textblock::join_basic_raw and textblock::join. " @values blocks -type any -multiple 1