From 69771445aa1e89955ec38e4cf3b6fb9a8da5538e Mon Sep 17 00:00:00 2001 From: Aleteoryx Date: Sat, 20 Sep 2025 01:38:15 -0400 Subject: [PATCH] see the sixels --- ntalk.tcl | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/ntalk.tcl b/ntalk.tcl index 5f441db85e5a3cac927287a069f3d29b24ff98e0..f9363d580aa18263373887b769394233931519fe 100755 --- a/ntalk.tcl +++ b/ntalk.tcl @@ -12,6 +12,9 @@ proc restart {} { exit 0 } +wm title . ". o ( ntalk ) o ." +tk appname ntalk + ### SIXEL LIB ### @@ -151,6 +154,35 @@ if {[catch {package require history}] == 0} { bind . quit bind . restart +bind . {.menu.opt invoke "show raw sixel codes"} + +.buffer tag configure rawsixel -elide true -foreground DarkSlateGrey + + +### MENU ### + +menu .menu +menu .menu.nt -tearoff 0 +menu .menu.opt -tearoff 1 + +.menu add cascade -label "ntalk" -menu .menu.nt +.menu.nt add command -label "about..." -command { + tk_dialog .about "about ntalk" \ + "ntalk\nby aleteoryx\nlast updated 2025-09-20" \ + "info" \ + 0 okay +} +.menu.nt add separator +.menu.nt add command -label "restart" -command restart -accelerator "Ctrl-Shift-R" +.menu.nt add command -label "quit" -command quit -accelerator "Ctrl-Q" + +.menu add cascade -label "options" -menu .menu.opt +.menu.opt add checkbutton -label "show raw sixel codes" \ + -accelerator "Ctrl-s" -variable showsixel -command { + .buffer tag configure rawsixel -elide [expr {!$showsixel}] +} + +. configure -menu .menu ### CONNECTING ### @@ -179,7 +211,7 @@ bind .buffer { .buffer mark set insert end focus .buffer vwait cscript -bind .buffer {} +bind . {} .buffer configure -state disabled set fp [open $scriptpath w] @@ -190,7 +222,7 @@ fconfigure $sok -translation lf; # dammit set user [string trim $user] .foot.name configure -text "${user}:" -wm title . "nanochatting on $server" +wm title . ". o ( nanochatting on $server ) o ." ### NETCODE ### @@ -239,6 +271,7 @@ proc bufpush {line} { if {$idx2 == -1} break # insert them + .buffer insert end [string range $line $idx1 $idx2] rawsixel set image [sixels2image [string range $line $idx1+2 $idx2-1]] .buffer image create end -image $image