Skip to content

Commit dfcd66d

Browse files
committed
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.
1 parent 9d8fced commit dfcd66d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎src/libc/posix/termios/tmwrite.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,10 @@ set_cursor_shape(int shape)
737737
{
738738
new_cursor = 0x2000;
739739
}
740+
else if (shape == NORMAL_CURSOR)
741+
{
742+
new_cursor = __tty_screen.init_cursor_shape;
743+
}
740744
else
741745
{
742746
max_line = _farpeekw(_dos_ds, 0x0485) - 1;
@@ -757,7 +761,7 @@ set_cursor_shape(int shape)
757761
if (shape == ENHANCED_CURSOR)
758762
top_line = 0;
759763
else
760-
top_line = bot_line + 1;
764+
top_line = bot_line - 1;
761765

762766
new_cursor = ((top_line & 0x1f) << 8) | (bot_line & 0x1f);
763767
}

0 commit comments

Comments
 (0)