this post was submitted on 14 Jul 2023
828 points (95.1% liked)
Programmer Humor
32361 readers
253 users here now
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
- Posts must be relevant to programming, programmers, or computer science.
- No NSFW content.
- Jokes must be in good taste. No hate speech, bigotry, etc.
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Why is that actually?
Because fuck you! That's why!
Edit: serious answer, I'm pretty sure it's outputting the key events to the terminal line.
Because terminal emulators are literally the old terminal emulators (ye oldy screens + keyboard combos that looked like a computer but were just IO) and everything modern they do is just a hack.
Terminals with screens? What's all that newfangled shit?
Nah, whippersnapper, this tech goes all the way back to teletypes. You didn't get a fancy-shmancy "screen;" instead, it printed out the results of your commands. On actual paper!
Seriously though, that's why the device files for terminals in Linux are named
tty[$NUM]
-- "tty" is shorthand for "TeleTYpe."I believe it's also why really primitive programs can't scroll up and do things like writing an entire screen worth of content in order to emulate interactivity (as opposed to seeking the cursor backwards and replacing only the parts the program wants to replace): they're using a version of the control protocol so primitive that it didn't have a function to go backwards because teletypes didn't need it due to physical impossibility. (That's my theory, anyway -- I haven't dug deep enough into the guts of TERMCAP etc. to be sure. I'm also not actually old enough to have experienced that stuff, despite my joke above.)
Edit: look at this excerpt from
man terminfo(5)
, for instance:To this day, the info database entry for your virtual terminal has to specify that it's capable of deleting a line of text instead of merely striking it out, because some terminals back in the day actually couldn't!