Skip to content
Snippets Groups Projects
Commit 96eff48e authored by rswindell's avatar rswindell
Browse files

Support UTF-8 auto-detection for MacOS Terminal v2.8.3 (404.1):

Unexpectedly, a ZWNBSP (U+FEFF) received/echoed by the MacOS Terminal while in
the first column causes a subsequent cursor position report to indicate the 2nd
column as the current only. I suppose in some weird world a zero-width
character can can't as a column position. So if the cursor position has moved
less than 2 columns (not exactly 0 columns), then consider it a UTF-8 terminal.
Non-UTF-8 terminals normally move the cursor 3 columns when echoing a UTF-8
encoded ZWNBSP. So to summarize, when echoing a ZWNBSP:

- Non-UTF-8 terminals: moves 3 columns
- MacOS terminal: moves 1 columns
- Other UTF-8 terminals: moves 0 columns
parent 4a4fd2f3
No related branches found
No related tags found
No related merge requests found
......@@ -359,7 +359,7 @@ bool sbbs_t::answer()
if(x >= TERM_COLS_MIN && x <= TERM_COLS_MAX) cols=x;
if(y >= TERM_ROWS_MIN && y <= TERM_ROWS_MAX) rows=y;
} else { // second report
if(x == 1) // ZWNBSP didn't move cursor
if(x < 3) // ZWNBSP didn't move cursor (more than one column)
autoterm |= UTF8;
}
} else if(sscanf(p, "[=67;84;101;114;109;%u;%u", &x, &y) == 2 && *lastchar(p) == 'c') {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment