diff --git a/src/terminal/terminal_handlers.c b/src/terminal/terminal_handlers.c index fd723676..4d795f4d 100644 --- a/src/terminal/terminal_handlers.c +++ b/src/terminal/terminal_handlers.c @@ -28,6 +28,7 @@ #include "terminal_handlers.h" #include +#include /** * Response string sent when identification is requested. @@ -46,6 +47,8 @@ int guac_terminal_echo(guac_terminal* term, unsigned char c) { + int width; + static int bytes_remaining = 0; static int codepoint = 0; @@ -206,8 +209,12 @@ int guac_terminal_echo(guac_terminal* term, unsigned char c) { term->cursor_col, codepoint); + width = wcwidth(codepoint); + if (width < 0) + width = 1; + /* Advance cursor */ - term->cursor_col++; + term->cursor_col += width; }