Post AjeFuJi58R5jInSdiC by jens@social.finkhaeuser.de
 (DIR) More posts by jens@social.finkhaeuser.de
 (DIR) Post #AjeFtqNsAUh8Limaga by b0rk@social.jvns.ca
       2024-07-05T15:35:45Z
       
       0 likes, 0 repeats
       
       what's one terminal feature you really love (other than tabs, copy&paste, scrollback/search, and mouse integration)? (specifically looking for features of a *terminal*, not of a shell etc -- would also love to hear which terminal has that feature!)
       
 (DIR) Post #AjeFtreZRte6HnbRLs by jens@social.finkhaeuser.de
       2024-07-06T05:43:31Z
       
       0 likes, 0 repeats
       
       @b0rk An interesting part of this thread is how little people distinguish between the terminal (emulator) and the shell.It reminds me of how difficult that was for me some decades ago. I'd forgotten I had trouble with that as well.
       
 (DIR) Post #AjeFtsQ4bHdwf7pNOS by jens@social.finkhaeuser.de
       2024-07-06T08:00:07Z
       
       0 likes, 1 repeats
       
       So in case anyone cares and doesn't know...The VT100 is a terminal ( https://en.m.wikipedia.org/wiki/VT100 ). This thread is about terminal emulators, so software that emulates what hardware such as this used to do.I picked the VT100 from DEC here, because it kind of is still the standard to which terminal emulators are held and which they implement. There are more modern terminals (VT104 comes to mind), and features emulators have that the hardware didn't. But it should still be possible to attach one...
       
 (DIR) Post #AjeFu1NvGeGqT3tHn6 by jens@social.finkhaeuser.de
       2024-07-06T08:02:43Z
       
       0 likes, 0 repeats
       
       ... of these things to a modern BSD or Linux machine and have it work. I haven't tried, to be fair.The picture also illustrates to some degree what the thing does: it outputs text. And it receives text input.A modern terminal emulator still mostly does that. Other than outputting plain text, it'll interpret command sequences, so sequences of Bytes that make it do special stuff. ANSI command sequences to colour the output, sequences to clear the screen or ring a bell/play a notification...
       
 (DIR) Post #AjeFu8Rj0uTIMsivBo by jens@social.finkhaeuser.de
       2024-07-06T08:05:48Z
       
       0 likes, 0 repeats
       
       ... sound, that kind of thing.In a nutshell, a terminal does very little more than this.As some folk mentioned, terminal emulators typically also provide a scrollback buffer, which is not something terminals did so much... or at least certainly not for the thousands of lines you might have configured nowadays. Nor did they make URLs clickable.Mouse support I'm a bit fuzzy on. There's something for mouse support, but a lot of what your terminal does, like copy and paste, is either a...
       
 (DIR) Post #AjeFuE9rmDke5EPkBc by jens@social.finkhaeuser.de
       2024-07-06T08:10:25Z
       
       0 likes, 0 repeats
       
       ... client side, and maybe converted to text input where necessary. I should write a terminal emulator one of those days to find the exact demarcation line here 😬Anyway, the terminal gets input piped to it by what other programs write to stdout/stderr, and its input gets piped to that program's stdin. The OS hooks the two together.So a bunch of features people mention are actually features of the shell they run. Command history is one of those examples. There is, in fact, a `history'...
       
 (DIR) Post #AjeFuJi58R5jInSdiC by jens@social.finkhaeuser.de
       2024-07-06T08:13:45Z
       
       0 likes, 0 repeats
       
       ... command to access and configure this.The bash shell that a lot of systems ship by default writes command history to a file, and interprets a number of input control sequences to access this history. You can search, or simply go up/down, etc. Most of this input magic, including cursor key handling (cursor keys are also control sequences) is implemented in the readline library.It's pretty easy to use readline to build simple shells.The complex part of shells is the shell language...
       
 (DIR) Post #AjeFuPQZsQef2FJkGG by jens@social.finkhaeuser.de
       2024-07-06T08:17:37Z
       
       0 likes, 0 repeats
       
       ... interpreter.When you launch a text editor from a shell in a terminal emulator, it uses control and command sequences to position the output cursor, draw fancy colored ASCII art frames, and all that.Often, this uses the ncurses library for the details. The application mostly drives it like another app might drive a GUI toolkit. If I'm not mistaken, saving the shell screen before drawing over it is an ncurses feature, not even a shell thing, but I'm not sure.At any rate, you can use...
       
 (DIR) Post #AjeFuSp9FX5jZJpuTY by jens@social.finkhaeuser.de
       2024-07-06T08:21:18Z
       
       0 likes, 0 repeats
       
       ... a control sequence like ctrl-z to bump the text editor or whatever you have running into the background (shell feature!), access the shell again, and use the `fg' command to bring it to the foreground again. This is not terminal (emulator) stuff.So something like tmux is an interesting beast. It is a program you launch from the shell, and it then emulates a terminal for each sub-shell it launches. It uses ncurses or something like it to render its text windows.And that's all I have.