From: Mark Jamsek Subject: Re: gotd: handle early client disconnections To: Christian Weisgerber Cc: gameoftrees@openbsd.org Date: Tue, 24 Jan 2023 01:10:23 +1100 On 23-01-23 12:47PM, Christian Weisgerber wrote: > On 2023-01-23, Mark Jamsek 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. That's super interesting! And makes a lot of sense for treating the 80 column limit as exclusive. Thanks for the history lesson :) Obviously less of a concern nowadays, but the etiology of these practices are always informative, and, unsurprisingly, rarely arbitrary. I've moved my column marker back one; I've treated that mark as inclusive for too long to change, so by moving it I can continue doing so while avoiding column 80 :) -- Mark Jamsek GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68