conhost: Avoid assumption about the exact Unix cursor position after writing to the last column.
Spotted by Roman Pišl. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50581 Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
22a1485c08
commit
9e97f3513e
|
@ -195,6 +195,14 @@ static void set_tty_cursor( struct console *console, unsigned int x, unsigned in
|
||||||
else if (!x && y == console->tty_cursor_y) strcpy( buf, "\r" );
|
else if (!x && y == console->tty_cursor_y) strcpy( buf, "\r" );
|
||||||
else if (y == console->tty_cursor_y)
|
else if (y == console->tty_cursor_y)
|
||||||
{
|
{
|
||||||
|
if (console->is_unix && console->tty_cursor_x >= console->active->width)
|
||||||
|
{
|
||||||
|
/* Unix will usually have the cursor at width-1 in this case. instead of depending
|
||||||
|
* on the exact behaviour, move the cursor to the first column and move forward
|
||||||
|
* from threre. */
|
||||||
|
tty_write( console, "\r", 1 );
|
||||||
|
console->tty_cursor_x = 0;
|
||||||
|
}
|
||||||
if (x + 1 == console->tty_cursor_x) strcpy( buf, "\b" );
|
if (x + 1 == console->tty_cursor_x) strcpy( buf, "\b" );
|
||||||
else if (x > console->tty_cursor_x) sprintf( buf, "\x1b[%uC", x - console->tty_cursor_x );
|
else if (x > console->tty_cursor_x) sprintf( buf, "\x1b[%uC", x - console->tty_cursor_x );
|
||||||
else sprintf( buf, "\x1b[%uD", console->tty_cursor_x - x );
|
else sprintf( buf, "\x1b[%uD", console->tty_cursor_x - x );
|
||||||
|
|
Loading…
Reference in New Issue