Live data from Hacker News

Textual Paint – MS Paint in your terminal

github.com

31–35 of 35 posts

Re: Textual Paint – MS Paint in your terminal

#31

Earlier quoted context omitted.

I spent most of the 90s writing Clipper code, used to hang out in comp.lang.clipper lots too. Do still sort of miss it. https://harbour.github.io/ does exist, although it’s a long while since I last played with that.

Clipper, BLINKER and the Brief editor FTW!

I was more of a qedit fan myself (later TSE), but yeah they were good days.

If you want a real blast from that past, there's even still an archived version of The Oasis kicking about: https://harbour.github.io/the-oasis/docs/

Re: Textual Paint – MS Paint in your terminal

#32
post #8

I expect, at the minimum: - a rust port - an emacs port :-)

How about bash? :p r() { read -n1 -r c; [ "$c" = "$1" ]; }; b=2; stty -echo -icanon; printf '\033[H\033[0m\033[J\033[?1003h'; while true; do r $'\033' || { printf '%s\n' "$c" | grep -qE '[0-7]' && b=$c; continue; }; r \[ || continue; r "M" || continue; r "@" && d=y || d=; read z x y z (you can change colour with digits 1..7 btw!)

is there a name/page/nonobfuscated version/git repo for that script?

Re: Textual Paint – MS Paint in your terminal

#33
post #8

I expect, at the minimum: - a rust port - an emacs port :-)

How about bash? :p r() { read -n1 -r c; [ "$c" = "$1" ]; }; b=2; stty -echo -icanon; printf '\033[H\033[0m\033[J\033[?1003h'; while true; do r $'\033' || { printf '%s\n' "$c" | grep -qE '[0-7]' && b=$c; continue; }; r \[ || continue; r "M" || continue; r "@" && d=y || d=; read z x y z (you can change colour with digits 1..7 btw!)

Ok, so I was a bit bored...

- no external grep anymore

- smaller (303 instead of 400 bytes)

- cleanup of mouse mode on exit

  p(){ for i;do printf "\e[$i";done;};r(){ read -rn1 c;[[ $c = $1 ]];};stty -echo cbreak;p H m J ?1003h;trap 'p ?1003l' 0;while d=;do r $'\e'||{ [[ $c =~ [0-7] ]]&&b=$c;continue;};r \[||continue;r M||continue;r @&&d=y;read _ x y _

Re: Textual Paint – MS Paint in your terminal

#34
post #32

Earlier quoted context omitted.

How about bash? :p r() { read -n1 -r c; [ "$c" = "$1" ]; }; b=2; stty -echo -icanon; printf '\033[H\033[0m\033[J\033[?1003h'; while true; do r $'\033' || { printf '%s\n' "$c" | grep -qE '[0-7]' && b=$c; continue; }; r \[ || continue; r "M" || continue; r "@" && d=y || d=; read z x y z (you can change colour with digits 1..7 btw!)

is there a name/page/nonobfuscated version/git repo for that script?

it's not intentionally obfuscated, it just happened like that :-) The only place I've posted it until now is on my oneliners collection, https://ocv.me/doc/unix/oneliners/#c58b5be6

Re: Textual Paint – MS Paint in your terminal

#35
post #22

Earlier quoted context omitted.

Oh man, I've long had the idea for a plain text diagram creator, great to see that someone has gone there before.

I started a library for this a while ago (using rich): https://github.com/mahrz24/netext Recently I tried to adopt it to textual as well: https://twitter.com/mahrz24/status/1679816272509386753?s=46&...

Cool, will check it out!
Post reply on HN