diff --git a/src/terminal/common.c b/src/terminal/common.c index df1e6f12..949f9704 100644 --- a/src/terminal/common.c +++ b/src/terminal/common.c @@ -21,6 +21,7 @@ */ #include "config.h" +#include "types.h" #include #include @@ -83,7 +84,8 @@ int guac_terminal_encode_utf8(int codepoint, char* utf8) { bool guac_terminal_has_glyph(int codepoint) { return codepoint != 0 - && codepoint != ' '; + && codepoint != ' ' + && codepoint != GUAC_CHAR_CONTINUATION; } int guac_terminal_write_all(int fd, const char* buffer, int size) { diff --git a/src/terminal/display.c b/src/terminal/display.c index 6a5ea431..df3ecebf 100644 --- a/src/terminal/display.c +++ b/src/terminal/display.c @@ -585,7 +585,8 @@ void guac_terminal_display_resize(guac_terminal_display* display, int width, int .attributes = { .foreground = 0, .background = 0 - } + }, + .width = 1 }; /* Free old operations buffer */ diff --git a/src/terminal/terminal.c b/src/terminal/terminal.c index a4d44fa2..46b3efc2 100644 --- a/src/terminal/terminal.c +++ b/src/terminal/terminal.c @@ -96,7 +96,8 @@ guac_terminal* guac_terminal_create(guac_client* client, .bold = false, .reverse = false, .underscore = false - }}; + }, + .width = 1}; guac_terminal* term = malloc(sizeof(guac_terminal)); term->client = client; diff --git a/src/terminal/types.h b/src/terminal/types.h index efa1c617..98962be8 100644 --- a/src/terminal/types.h +++ b/src/terminal/types.h @@ -28,6 +28,15 @@ #include +/** + * A character which is not truly a character, but rather part of an + * existing character which spans multiple columns. The original + * character will be somewhere earlier in the row, separated from + * this character by a contiguous string of zero of more + * GUAC_CHAR_CONTINUATION characters. + */ +#define GUAC_CHAR_CONTINUATION -1 + /** * An RGB color, where each component ranges from 0 to 255. */ @@ -95,7 +104,9 @@ typedef struct guac_terminal_attributes { typedef struct guac_terminal_char { /** - * The Unicode codepoint of the character to display. + * The Unicode codepoint of the character to display, or + * GUAC_CHAR_CONTINUATION if this character is part of + * another character which spans multiple columns. */ int value; @@ -104,6 +115,12 @@ typedef struct guac_terminal_char { */ guac_terminal_attributes attributes; + /** + * The number of columns this character occupies. If the character is + * GUAC_CHAR_CONTINUATION, this value is undefined and not applicable. + */ + int width; + } guac_terminal_char; #endif