From 8b7ab07e48c71bc3ec8a97e546858437fdf71f6f Mon Sep 17 00:00:00 2001 From: corentin-soriano Date: Tue, 8 Oct 2024 13:58:25 +0200 Subject: [PATCH] GUACAMOLE-1961: Detect accented letters as a part of word. --- src/terminal/terminal.c | 4 +++- src/terminal/terminal/terminal.h | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/terminal/terminal.c b/src/terminal/terminal.c index 5a48f08b2..648d6255d 100644 --- a/src/terminal/terminal.c +++ b/src/terminal/terminal.c @@ -1610,7 +1610,7 @@ int guac_terminal_send_key(guac_terminal* term, int keysym, int pressed) { /** * Determines if the given character is part of a word. - * Match these chars :[0-9A-Za-z\$\-\.\/_~] + * Match these chars :[0-9A-Za-z\$\-\.\/_~] and accented letters. * This allows a path, variable name or IP address to be treated as a word. * * @param ascii_char @@ -1624,6 +1624,8 @@ static bool guac_terminal_is_part_of_word(int ascii_char) { return ((ascii_char >= '0' && ascii_char <= '9') || (ascii_char >= 'A' && ascii_char <= 'Z') || (ascii_char >= 'a' && ascii_char <= 'z') || + (ascii_char >= GUAC_TERMINAL_LATIN1_CAPITAL_AGRAVE && + ascii_char <= GUAC_TERMINAL_LATIN1_Y_UMLAUT) || (ascii_char == '$') || (ascii_char == '-') || (ascii_char == '.') || diff --git a/src/terminal/terminal/terminal.h b/src/terminal/terminal/terminal.h index 11c8fb5a3..981dea0de 100644 --- a/src/terminal/terminal/terminal.h +++ b/src/terminal/terminal/terminal.h @@ -111,6 +111,16 @@ */ #define GUAC_TERMINAL_PIPE_AUTOFLUSH 2 +/** + * Latin 1 capital A grave, it's the first character of the accented range. + */ +#define GUAC_TERMINAL_LATIN1_CAPITAL_AGRAVE 192 + +/** + * Latin 1 small y umlaut, it's the latest character of the accented range. + */ +#define GUAC_TERMINAL_LATIN1_Y_UMLAUT 255 + /** * Represents a terminal emulator which uses a given Guacamole client to * render itself.