Download raw body.
gotd: handle early client disconnections
On 2023-01-23, Mark Jamsek <mark@jamsek.com> wrote: > Oh whoops, I've been doing it wrong! I always thought it was [1,80] not > [1,80) :) There was a historical reason to stay clear of the 80th column. A traditional video terminal had 80 columns. Let's say you write 79 characters from the start of the line. Now your cursor is on the final column. Then you write another character. What happens next? In early video terminals, the cursor would wrap around and advance to the first column of the next line. If you then wrote a newline to move one line down, the cursor would be _two_ lines down. Oops. Also, if you wrote to the final column of the bottommost line, the cursor would wrap around and the screen would scroll up one line. Which means you could never fill the screen completely. Some terminals introduced a modified behavior: When you write to the final column of a line, the cursor stays there. It will only wrap around if you write one more character; effectively the cursor position jumps by two characters. The termcap(5) property "xn" marks a terminal with this behavior. All DEC terminal starting from the VT100 had it. So does xterm, etc. I think the last terminal I ran into that didn't have this was some earlier iteration of the FreeBSD console, but we're a few rewrites beyond that, too. So, yeah, I don't think it's a concern nowadays. Anyway, that's the historical reason why people tended to avoid writing to the final column. -- Christian "naddy" Weisgerber naddy@mips.inka.de
gotd: handle early client disconnections