Re:"Rules" that terminal programs follow
by lilyball on Friday December 13, 2024 @03:41PM
(#42412165)
I read up on this and "cooked but character-by-character" is apparently something called "cbreak mode" (or "rare mode").
[ Parent
| on HN ]
According to stty(1), ”cbreak” is a negative alias of “icanon”, which simply enables the special functions of the ‘erase’ (backspace), ‘kill’ (Ctrl-U), ‘werase’ (Ctrl-W), and ‘rprnt’ (Ctrl-R) keybindings. “cooked” mode includes “icanon”.
So no, I do not think that what you wrote is correct. From what I can tell, the line-by-line mode is “extproc”.
Re:"Rules" that terminal programs follow
by lilyball on Monday December 16, 2024 @06:20PM
(#42436602)
On macOS, running `stty cbreak; tr a-zA-Z A-Za-z` causes `tr` to immediately transform every character as it's typed. If I SSH into a linux box that doesn't work, though I'm wondering if that's SSH's fault (it's not convenient right now to get direct access). Certainly the Linux manpage for stty(1) documents a setting
min N with -icanon, set N characters minimum for a completed read
which suggests that if you set -icanon (e.g. cbreak) then reads may complete after 1 character.Also on macOS the documentation for cbreak is different, it lists a bunch of settings including -icanon, it's Linux that makes it literally an alias for -icanon.