[PATCH] conhost: Keep horizontal position of cursor within screen width.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50581 Signed-off-by: Roman Pišl <rpisl(a)seznam.cz> --- programs/conhost/conhost.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c index 0ac1c5f507b..418098420c6 100644 --- a/programs/conhost/conhost.c +++ b/programs/conhost/conhost.c @@ -357,7 +357,9 @@ static void update_output( struct screen_buffer *screen_buffer, RECT *rect ) size = WideCharToMultiByte( get_tty_cp( screen_buffer->console ), 0, &ch->ch, 1, buf, sizeof(buf), NULL, NULL ); tty_write( screen_buffer->console, buf, size ); - screen_buffer->console->tty_cursor_x++; + + if (screen_buffer->console->tty_cursor_x < screen_buffer->width - 1) + screen_buffer->console->tty_cursor_x++; } } -- 2.20.1
Hi Roman, On 31.01.2021 01:04, Roman Pišl wrote:
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50581
Signed-off-by: Roman Pišl <rpisl(a)seznam.cz> --- programs/conhost/conhost.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c index 0ac1c5f507b..418098420c6 100644 --- a/programs/conhost/conhost.c +++ b/programs/conhost/conhost.c @@ -357,7 +357,9 @@ static void update_output( struct screen_buffer *screen_buffer, RECT *rect ) size = WideCharToMultiByte( get_tty_cp( screen_buffer->console ), 0, &ch->ch, 1, buf, sizeof(buf), NULL, NULL ); tty_write( screen_buffer->console, buf, size ); - screen_buffer->console->tty_cursor_x++; + + if (screen_buffer->console->tty_cursor_x < screen_buffer->width - 1) + screen_buffer->console->tty_cursor_x++; } }
I don't know why Testbot didn't mark it on patch status page, but I can reproduce those failures locally: https://testbot.winehq.org/JobDetails.pl?Key=84781 It would be good to have a test case for the change. Also note skip_sequence("\b")s in tests. This is something that some Windows versions do and may be relevant to your problem (through that's just a guess). Thanks, Jacek
participants (2)
-
Jacek Caban -
Roman Pišl