#foreground and background are the same char - but vt52 has separate modes for fg/bg - so we could just return the char and let caller decide which mode to be in
return \x1bb${char}
}
@ -6800,12 +6808,14 @@ be as if this was off - ie lone CR.
error "punk::console::ansi expected a boolean e.g 0|1|on|off|true|false|yes|no"
}
if {$onoff} {
set ansi_wanted 1
} else {
set ansi_wanted 0
punk::ansi::sgr_cache -action clear
}
catch {punk::repl::reset_prompt}
}
catch {punk::repl::reset_prompt}
puts stderr "::punk::console::ansi - use 'colour' command to turn SGR codes on/off"
puts stderr "::punk::console::ansi - use 'colour' command to turn SGR codes on/off (except bold/underline/reverse which are controlled by 'ansi' command)"
return [expr {$ansi_wanted}]
}
@ -863,8 +847,8 @@ namespace eval punk::console {
#test - find a better place to set terminal type
variable is_vt52 0
proc vt52 {{onoff {}}} {
#todo - return to colour state beforehand?. support 0-15 vt52 colours?
#we shouldn't have to trun off colour to enter vt52 - we should make punk::console emit correct codes
#todo - return to colour state beforehand?. support 0-15 vt52 colours? (ATARI and some emulators - not original vt52)
#we shouldn't have to turn off colour to enter vt52 - we should make punk::console emit correct codes
#this *very odd* construct is to avoid using the namespace argument of apply. (handling of *weird/inadvisable* namespaces)
#we use an uplevel from within the apply which runs in the global namespace, (but called via nseval from within targetns) and a result var for 'info default' in the current punk::ns namespace.
set bodytext [punk::ansi::untabify -with $untabify -stops $tw $bodytext]
}
append body [punk::lib::indent $bodytext $indent]
set opt_indent 0
if {$opt_indent} {
#we generally don't want to indent the body.
#Some text strings are constructed based on specific indentation.
append body [punk::lib::indent $bodytext $indent]
} else {
#no indent - more likely we could run the result (if -syntax none) to regenerate the proc with strings intact regarding their spacing relative to the left margin.
# ::return [::list default $punk_ns_corp_defvar][::unset punk_ns_corp_defvar] ;#keep the targetns tidy
# } else {
# ::return [::list none]
# }
#}]]
#this very odd construct is to avoid using the namespace argument of apply. (handling of *weird/inadvisable* namespaces)
#we use an uplevel from within the apply which runs in the global namespace, (but called via nseval from within targetns) and a result var for 'info default' in the current punk::ns namespace.
#set result [nseval $targetns [list apply [list {procname argname} {
# set has_default [uplevel 1 [list info default $procname $argname ::punk::ns::corp_defvar]]
# if {$has_default} {
# set answer [list default $::punk::ns::corp_defvar]
# } else {
# set answer [list none]
# }
# unset ::punk::ns::corp_defvar
# return $answer
#} ] $name $a]]
#if {[lindex $result 0] eq "default"} {
# lappend a [lindex $result 1]
#}
set default_info [info_default $targetns $name $a]
if {[dict get $default_info exists]} {
lappend a [dict get $default_info default]
}
lappend argl $a
}
#list proc [nsjoin ${targetns} $name] $argl $body
#todo - load highlighters as functions from somewhere
#foreground and background are the same char - but vt52 has separate modes for fg/bg - so we could just return the char and let caller decide which mode to be in
return \x1bb${char}
}
@ -6800,12 +6808,14 @@ be as if this was off - ie lone CR.
error "punk::console::ansi expected a boolean e.g 0|1|on|off|true|false|yes|no"
}
if {$onoff} {
set ansi_wanted 1
} else {
set ansi_wanted 0
punk::ansi::sgr_cache -action clear
}
catch {punk::repl::reset_prompt}
}
catch {punk::repl::reset_prompt}
puts stderr "::punk::console::ansi - use 'colour' command to turn SGR codes on/off"
puts stderr "::punk::console::ansi - use 'colour' command to turn SGR codes on/off (except bold/underline/reverse which are controlled by 'ansi' command)"
return [expr {$ansi_wanted}]
}
@ -863,8 +847,8 @@ namespace eval punk::console {
#test - find a better place to set terminal type
variable is_vt52 0
proc vt52 {{onoff {}}} {
#todo - return to colour state beforehand?. support 0-15 vt52 colours?
#we shouldn't have to trun off colour to enter vt52 - we should make punk::console emit correct codes
#todo - return to colour state beforehand?. support 0-15 vt52 colours? (ATARI and some emulators - not original vt52)
#we shouldn't have to turn off colour to enter vt52 - we should make punk::console emit correct codes
#this *very odd* construct is to avoid using the namespace argument of apply. (handling of *weird/inadvisable* namespaces)
#we use an uplevel from within the apply which runs in the global namespace, (but called via nseval from within targetns) and a result var for 'info default' in the current punk::ns namespace.
set bodytext [punk::ansi::untabify -with $untabify -stops $tw $bodytext]
}
append body [punk::lib::indent $bodytext $indent]
set opt_indent 0
if {$opt_indent} {
#we generally don't want to indent the body.
#Some text strings are constructed based on specific indentation.
append body [punk::lib::indent $bodytext $indent]
} else {
#no indent - more likely we could run the result (if -syntax none) to regenerate the proc with strings intact regarding their spacing relative to the left margin.
# ::return [::list default $punk_ns_corp_defvar][::unset punk_ns_corp_defvar] ;#keep the targetns tidy
# } else {
# ::return [::list none]
# }
#}]]
#this very odd construct is to avoid using the namespace argument of apply. (handling of *weird/inadvisable* namespaces)
#we use an uplevel from within the apply which runs in the global namespace, (but called via nseval from within targetns) and a result var for 'info default' in the current punk::ns namespace.
#set result [nseval $targetns [list apply [list {procname argname} {
# set has_default [uplevel 1 [list info default $procname $argname ::punk::ns::corp_defvar]]
# if {$has_default} {
# set answer [list default $::punk::ns::corp_defvar]
# } else {
# set answer [list none]
# }
# unset ::punk::ns::corp_defvar
# return $answer
#} ] $name $a]]
#if {[lindex $result 0] eq "default"} {
# lappend a [lindex $result 1]
#}
set default_info [info_default $targetns $name $a]
if {[dict get $default_info exists]} {
lappend a [dict get $default_info default]
}
lappend argl $a
}
#list proc [nsjoin ${targetns} $name] $argl $body
#todo - load highlighters as functions from somewhere
#foreground and background are the same char - but vt52 has separate modes for fg/bg - so we could just return the char and let caller decide which mode to be in
return \x1bb${char}
}
@ -6800,12 +6808,14 @@ be as if this was off - ie lone CR.
error "punk::console::ansi expected a boolean e.g 0|1|on|off|true|false|yes|no"
}
if {$onoff} {
set ansi_wanted 1
} else {
set ansi_wanted 0
punk::ansi::sgr_cache -action clear
}
catch {punk::repl::reset_prompt}
}
catch {punk::repl::reset_prompt}
puts stderr "::punk::console::ansi - use 'colour' command to turn SGR codes on/off"
puts stderr "::punk::console::ansi - use 'colour' command to turn SGR codes on/off (except bold/underline/reverse which are controlled by 'ansi' command)"
return [expr {$ansi_wanted}]
}
@ -863,8 +847,8 @@ namespace eval punk::console {
#test - find a better place to set terminal type
variable is_vt52 0
proc vt52 {{onoff {}}} {
#todo - return to colour state beforehand?. support 0-15 vt52 colours?
#we shouldn't have to trun off colour to enter vt52 - we should make punk::console emit correct codes
#todo - return to colour state beforehand?. support 0-15 vt52 colours? (ATARI and some emulators - not original vt52)
#we shouldn't have to turn off colour to enter vt52 - we should make punk::console emit correct codes
#this *very odd* construct is to avoid using the namespace argument of apply. (handling of *weird/inadvisable* namespaces)
#we use an uplevel from within the apply which runs in the global namespace, (but called via nseval from within targetns) and a result var for 'info default' in the current punk::ns namespace.
set bodytext [punk::ansi::untabify -with $untabify -stops $tw $bodytext]
}
append body [punk::lib::indent $bodytext $indent]
set opt_indent 0
if {$opt_indent} {
#we generally don't want to indent the body.
#Some text strings are constructed based on specific indentation.
append body [punk::lib::indent $bodytext $indent]
} else {
#no indent - more likely we could run the result (if -syntax none) to regenerate the proc with strings intact regarding their spacing relative to the left margin.
# ::return [::list default $punk_ns_corp_defvar][::unset punk_ns_corp_defvar] ;#keep the targetns tidy
# } else {
# ::return [::list none]
# }
#}]]
#this very odd construct is to avoid using the namespace argument of apply. (handling of *weird/inadvisable* namespaces)
#we use an uplevel from within the apply which runs in the global namespace, (but called via nseval from within targetns) and a result var for 'info default' in the current punk::ns namespace.
#set result [nseval $targetns [list apply [list {procname argname} {
# set has_default [uplevel 1 [list info default $procname $argname ::punk::ns::corp_defvar]]
# if {$has_default} {
# set answer [list default $::punk::ns::corp_defvar]
# } else {
# set answer [list none]
# }
# unset ::punk::ns::corp_defvar
# return $answer
#} ] $name $a]]
#if {[lindex $result 0] eq "default"} {
# lappend a [lindex $result 1]
#}
set default_info [info_default $targetns $name $a]
if {[dict get $default_info exists]} {
lappend a [dict get $default_info default]
}
lappend argl $a
}
#list proc [nsjoin ${targetns} $name] $argl $body
#todo - load highlighters as functions from somewhere
#foreground and background are the same char - but vt52 has separate modes for fg/bg - so we could just return the char and let caller decide which mode to be in
return \x1bb${char}
}
@ -6800,12 +6808,14 @@ be as if this was off - ie lone CR.
error "punk::console::ansi expected a boolean e.g 0|1|on|off|true|false|yes|no"
}
if {$onoff} {
set ansi_wanted 1
} else {
set ansi_wanted 0
punk::ansi::sgr_cache -action clear
}
catch {punk::repl::reset_prompt}
}
catch {punk::repl::reset_prompt}
puts stderr "::punk::console::ansi - use 'colour' command to turn SGR codes on/off"
puts stderr "::punk::console::ansi - use 'colour' command to turn SGR codes on/off (except bold/underline/reverse which are controlled by 'ansi' command)"
return [expr {$ansi_wanted}]
}
@ -863,8 +847,8 @@ namespace eval punk::console {
#test - find a better place to set terminal type
variable is_vt52 0
proc vt52 {{onoff {}}} {
#todo - return to colour state beforehand?. support 0-15 vt52 colours?
#we shouldn't have to trun off colour to enter vt52 - we should make punk::console emit correct codes
#todo - return to colour state beforehand?. support 0-15 vt52 colours? (ATARI and some emulators - not original vt52)
#we shouldn't have to turn off colour to enter vt52 - we should make punk::console emit correct codes
#this *very odd* construct is to avoid using the namespace argument of apply. (handling of *weird/inadvisable* namespaces)
#we use an uplevel from within the apply which runs in the global namespace, (but called via nseval from within targetns) and a result var for 'info default' in the current punk::ns namespace.
set bodytext [punk::ansi::untabify -with $untabify -stops $tw $bodytext]
}
append body [punk::lib::indent $bodytext $indent]
set opt_indent 0
if {$opt_indent} {
#we generally don't want to indent the body.
#Some text strings are constructed based on specific indentation.
append body [punk::lib::indent $bodytext $indent]
} else {
#no indent - more likely we could run the result (if -syntax none) to regenerate the proc with strings intact regarding their spacing relative to the left margin.
# ::return [::list default $punk_ns_corp_defvar][::unset punk_ns_corp_defvar] ;#keep the targetns tidy
# } else {
# ::return [::list none]
# }
#}]]
#this very odd construct is to avoid using the namespace argument of apply. (handling of *weird/inadvisable* namespaces)
#we use an uplevel from within the apply which runs in the global namespace, (but called via nseval from within targetns) and a result var for 'info default' in the current punk::ns namespace.
#set result [nseval $targetns [list apply [list {procname argname} {
# set has_default [uplevel 1 [list info default $procname $argname ::punk::ns::corp_defvar]]
# if {$has_default} {
# set answer [list default $::punk::ns::corp_defvar]
# } else {
# set answer [list none]
# }
# unset ::punk::ns::corp_defvar
# return $answer
#} ] $name $a]]
#if {[lindex $result 0] eq "default"} {
# lappend a [lindex $result 1]
#}
set default_info [info_default $targetns $name $a]
if {[dict get $default_info exists]} {
lappend a [dict get $default_info default]
}
lappend argl $a
}
#list proc [nsjoin ${targetns} $name] $argl $body
#todo - load highlighters as functions from somewhere
#foreground and background are the same char - but vt52 has separate modes for fg/bg - so we could just return the char and let caller decide which mode to be in
return \x1bb${char}
}
@ -6800,12 +6808,14 @@ be as if this was off - ie lone CR.
error "punk::console::ansi expected a boolean e.g 0|1|on|off|true|false|yes|no"
}
if {$onoff} {
set ansi_wanted 1
} else {
set ansi_wanted 0
punk::ansi::sgr_cache -action clear
}
catch {punk::repl::reset_prompt}
}
catch {punk::repl::reset_prompt}
puts stderr "::punk::console::ansi - use 'colour' command to turn SGR codes on/off"
puts stderr "::punk::console::ansi - use 'colour' command to turn SGR codes on/off (except bold/underline/reverse which are controlled by 'ansi' command)"
return [expr {$ansi_wanted}]
}
@ -863,8 +847,8 @@ namespace eval punk::console {
#test - find a better place to set terminal type
variable is_vt52 0
proc vt52 {{onoff {}}} {
#todo - return to colour state beforehand?. support 0-15 vt52 colours?
#we shouldn't have to trun off colour to enter vt52 - we should make punk::console emit correct codes
#todo - return to colour state beforehand?. support 0-15 vt52 colours? (ATARI and some emulators - not original vt52)
#we shouldn't have to turn off colour to enter vt52 - we should make punk::console emit correct codes
#this *very odd* construct is to avoid using the namespace argument of apply. (handling of *weird/inadvisable* namespaces)
#we use an uplevel from within the apply which runs in the global namespace, (but called via nseval from within targetns) and a result var for 'info default' in the current punk::ns namespace.
set bodytext [punk::ansi::untabify -with $untabify -stops $tw $bodytext]
}
append body [punk::lib::indent $bodytext $indent]
set opt_indent 0
if {$opt_indent} {
#we generally don't want to indent the body.
#Some text strings are constructed based on specific indentation.
append body [punk::lib::indent $bodytext $indent]
} else {
#no indent - more likely we could run the result (if -syntax none) to regenerate the proc with strings intact regarding their spacing relative to the left margin.
# ::return [::list default $punk_ns_corp_defvar][::unset punk_ns_corp_defvar] ;#keep the targetns tidy
# } else {
# ::return [::list none]
# }
#}]]
#this very odd construct is to avoid using the namespace argument of apply. (handling of *weird/inadvisable* namespaces)
#we use an uplevel from within the apply which runs in the global namespace, (but called via nseval from within targetns) and a result var for 'info default' in the current punk::ns namespace.
#set result [nseval $targetns [list apply [list {procname argname} {
# set has_default [uplevel 1 [list info default $procname $argname ::punk::ns::corp_defvar]]
# if {$has_default} {
# set answer [list default $::punk::ns::corp_defvar]
# } else {
# set answer [list none]
# }
# unset ::punk::ns::corp_defvar
# return $answer
#} ] $name $a]]
#if {[lindex $result 0] eq "default"} {
# lappend a [lindex $result 1]
#}
set default_info [info_default $targetns $name $a]
if {[dict get $default_info exists]} {
lappend a [dict get $default_info default]
}
lappend argl $a
}
#list proc [nsjoin ${targetns} $name] $argl $body
#todo - load highlighters as functions from somewhere