tty-win: fix absolute cursor positioning

This commit is contained in:
Bert Belder 2011-09-27 16:10:06 +02:00
parent b0a9d601c8
commit f5f005d51d

View File

@ -1319,13 +1319,21 @@ static int uv_tty_write_bufs(uv_tty_t* handle, uv_buf_t bufs[], int bufcnt,
uv_tty_move_caret(handle, 0, 0, y, 1, error);
break;
case 'H':
case 'f':
/* Cursor absolute */
case 'G':
/* cursor horizontal move absolute */
FLUSH_TEXT();
x = (handle->ansi_csi_argc >= 1 && handle->ansi_csi_argv[0])
? handle->ansi_csi_argv[0] - 1 : 0;
y = (handle->ansi_csi_argc >= 2 && handle->ansi_csi_argv[1])
uv_tty_move_caret(handle, x, 0, 0, 1, error);
break;
case 'H':
case 'f':
/* cursor move absolute */
FLUSH_TEXT();
y = (handle->ansi_csi_argc >= 1 && handle->ansi_csi_argv[0])
? handle->ansi_csi_argv[0] - 1 : 0;
x = (handle->ansi_csi_argc >= 2 && handle->ansi_csi_argv[1])
? handle->ansi_csi_argv[1] - 1 : 0;
uv_tty_move_caret(handle, x, 0, y, 0, error);
break;