←back to thread

422 points km | 3 comments | | HN request time: 0.001s | source
Show context
lynx23 ◴[] No.41831472[source]
Can OP please tell me how to abolsih CR while in Raw Mode? Did he forget about it, or am I just unimaginative?
replies(1): >>41831711 #
1. samatman ◴[] No.41831711[source]
Right, you don't need to search that hard for a device which interprets 0xA as a line feed, just set your terminal to raw mode, done.

But given the very first sentence:

> CR and NL are both useful control characters.

I'm willing to conclude that he doesn't intend A Blaste Against The Useless Appendage of Carriage Return Upon a New Line, or Line Feed As Some Style It, to apply to emulators of the old devices which make actual use of the distinction.

replies(1): >>41845339 #
2. lynx23 ◴[] No.41845339[source]
I know that we're technically emulating old devices... But that time is so long gone. I actually never worked on a hardware terminal in my entire career, which is already almost 30 years. I think it is about time to stop calling it emulation, because thats no longer what it is. Its simply the way how text mode applications do I/O. It has become so ubiquitous that ncurses is slowly going out of fashion, because you might as well just use the common ANSI escape sequences, because they're supported everywhere anyways. IOW, raw mode isn't just an emulation required to get a 50 year old peripheral device to work, its necessary for almost everything that sits between an CLI and a GUI.
replies(1): >>41848904 #
3. samatman ◴[] No.41848904[source]
I agree with this, and generally take pains to refer to the programs as terminals, not terminal emulators. But at the same time, when a user presses the enter key and stdin provides CR, if you're in raw mode, you can get NL semantics by emitting CRLF to stdout, and that does in fact emulate the behavior of DEC terminals, which do that because teletypes did.

> I actually never worked on a hardware terminal in my entire career

I used to look books up at the library using a VT220. In the late 1990s they replaced that with an ASPX web browser endpoint running on PC hardware, and it was terrible. But I'm also not quite old enough to have used them for programming.

You're completely correct that it's no longer emulation of hardware terminals, there are dozens of input and output sequences which no hardware terminal ever used or understood. In many ways it's now emulation of XTerm, but even that era is slowly being left behind.