Maybe I don’t have the vocabulary to phrase this right, because I pretty much tossed “how does the terminal work?” into the “omg, nevermind” bucket a long time ago when it sounded like emulators on emulators on emulators
I’m a little scared to peel back the onion, but do you know what mode is the default?
Like, if code just does `std::cin >> ` or `std::getline`, is the mode a property of the … heck, I don’t even know, the “file like object” that’s providing stdin?
yeah it's a property of the TTY (the "file like object that's providing stdin" like you said). The mode is stored inside the operating system and the way programs control it is with `ioctl` system calls (I think they use the ncurses library to send those syscalls)
Comments
I thought the backspace, ctrl-w, ctrl-… behaviors we all got used to was because everyone was using libreadline to actually handle the raw input
1. use canonical mode
2. implement their own (usually by using libreadline or something similar)
#2 is by FAR the most common approach, and in that case Ctrl+W is handled by libreadline, but in case #1 the OS handles Ctrl+W
Like, if code just does `std::cin >> ` or `std::getline`, is the mode a property of the … heck, I don’t even know, the “file like object” that’s providing stdin?
yeah it's a property of the TTY (the "file like object that's providing stdin" like you said). The mode is stored inside the operating system and the way programs control it is with `ioctl` system calls (I think they use the ncurses library to send those syscalls)
To return the favor:
After you highlight or circle something in your phone’s image editor, linger your finger on your screen to auto-correct what you drew.