From dfcd66d34ecb1fbf8d16cbe4775f6ddeaa3555b4 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 3 Oct 2026 10:49:36 +0000 Subject: [PATCH] termios: ESC[v restores the initial cursor shape set_cursor_shape() computed the normal cursor as top_line = bot_line + 1, which gives start > end: 15-14 for the 8x16 font and 8-7 for 8x8. VGA does not draw such a cursor at all, and dosemu only showed it via its split cursor emulation. Make ESC[v (cnorm) restore the cursor shape saved at init, the one the console had before. Also correct the computed normal shape to bot_line - 1. --- src/libc/posix/termios/tmwrite.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libc/posix/termios/tmwrite.c b/src/libc/posix/termios/tmwrite.c index a7ad66a4..a229e1b2 100644 --- a/src/libc/posix/termios/tmwrite.c +++ b/src/libc/posix/termios/tmwrite.c @@ -737,6 +737,10 @@ set_cursor_shape(int shape) { new_cursor = 0x2000; } + else if (shape == NORMAL_CURSOR) + { + new_cursor = __tty_screen.init_cursor_shape; + } else { max_line = _farpeekw(_dos_ds, 0x0485) - 1; @@ -757,7 +761,7 @@ set_cursor_shape(int shape) if (shape == ENHANCED_CURSOR) top_line = 0; else - top_line = bot_line + 1; + top_line = bot_line - 1; new_cursor = ((top_line & 0x1f) << 8) | (bot_line & 0x1f); }