4 ms·
> but i swear to god developers have so completely forgotten how terminals work that i might be one of a handful of people left on earth who actually has the kn
by csdvrx 4y ago
> but i swear to god developers have so completely forgotten how terminals work that i might be one of a handful of people left on earth who actually has the knowledge to, so they all just layer their bullshit on top of ncurses (which should never have survived the '90s) instead and it's maddening.
Actually, yes, understanding the tty in detail seems to become a dark art.
However it's the best way to do complex things quickly: I did use some of these tricks like storing and then restoring the cursor position to have the time at which a command stop executing ABOVE the command itself and next to the time it started executing in https://github.com/csdvrx/bash-timestamping-sqlite https://github.com/csdvrx/bash-timestamping-sqlite
I had to, because I was using MSYS2 and the time to execute a command was a limiting factor in Windows before WSL2.
- melissalobos 4y agoIt looks like you have done a lot of work with sixels based on your github too. Have you ever written anything about that?
- csdvrx 4y ago> Have you ever written anything about that? No, WYSIWYG: I don't bother much more than that with explaining how it's done: the source code + the comments + the github page already give all the details away to whoever wants to dig deeper. I'm not much into social media or self promotion either: if people like what I do, they'll use it - I don't care much more than that, as everything was written for myself and my selfish needs first. The tty/sixel world is very small world anyway, we generally know and recognize eachother, so we know where to look for cool new stuff :)
- jart 4y agoNot just sixels but she also has the most superior tool for rendering images as unicode blocks. https://github.com/csdvrx/derasterize https://github.com/csdvrx/derasterize
- csdvrx 4y agooh hello there :) To be fair it was more like a joint venture between us!
- dllthomas 4y agoI do wish there was a save/restore cursor variant that would scroll with the text.
- csdvrx 4y agoIt should be a super simple feature to add to your terminal emulator: SCP works with a X,Y position. RCP just "jumps" there. If you keep an accounting of how many lines you have displayed since then, you could alter the response to RCP by also doing the appropriate amount of scrolling: it should only take one variable, the deltaY to scroll. If you want to test the idea, I think you could even use tmux and send commands to control the scrollback cf ahttps://superuser.com/questions/209437/how-do-i-scroll-in-tmux https://superuser.com/questions/209437/how-do-i-scroll-in-tm... I've used similar tricks with RCP/SCP but for simpler things: the only slight difficulty is the deltaY accounting, like when you are executing commands near the bottom of the screen because you must take into account that scolling will happen - but it's essentially similar to your idea. So check https://github.com/csdvrx/bash-timestamping-sqlite/blob/main/bashrc.txt https://github.com/csdvrx/bash-timestamping-sqlite/blob/main... and make sure you understand both how the __notbottom function works, and why PS0 needs an extra Esc[2a Actually, now that I think more about your idea, it would be sweet to keep a SCP/RCP stack with multiple values, where you can push values with each SCP then pop them with RCP, say in sequence, or maybe just access the nth value with a different command that wouldn't pop them? That could be done nicely by augmenting RCP. Also you could augment SCP with an optional flag to specify whether the terminal should scroll back upon RCP of this nth entry, and you'd have a great function that would be quite useful (ex: SCP with a jump bool when the return is non 0: you could make a shortcut to jump to the commands that have returned errors) There's no reason to stop adding cool features to terminals: we're in a terminal renaissance!