@blinry and 0x0a \n for line feed basically what you do on typewriters to get to the next line. In more recent ones (40s or so) combined with carriage return lever \r (0x0d). That’s why you have both as a newline in windows.
Conversation
Notices
-
Embed this notice
Michael Hunger (mesirii@chaos.social)'s status on Saturday, 07-Dec-2024 06:32:06 JST Michael Hunger
-
Embed this notice
blinry (blinry@chaos.social)'s status on Saturday, 07-Dec-2024 06:32:07 JST blinry
I just realized that backspace is called like that because it *literally* did the reverse thing of space on typewriters! :O You typed space to move right, and backspace to move left in a line!!
Amazing how much of typewriter legacy we carry around on our modern computers! 🤯
-
Embed this notice
blinry (blinry@chaos.social)'s status on Saturday, 07-Dec-2024 06:32:08 JST blinry
I'm building a tiny terminal emulator from scratch, to better understand how they work!
And I found something cool: My backspace key wasn't working. I was sending ASCII 0x8 to `sh`, but it just replied with "^H".
Turns out you can change that! `stty -a` showed me that the erase character was set to "^?" (whatever that is). So I changed it with `stty erase ^H", and now it works!
`sh` even outputs the sequence <backspace><space><backspace>, like a typewriter "overtyping" a letter with a space!
-
Embed this notice