From eb5aa14a6fac9b10201a48960bacdac274c251be Mon Sep 17 00:00:00 2001 From: Jim Chen Date: Thu, 23 Aug 2018 23:36:26 -0400 Subject: [PATCH] GUACAMOLE-470: Support named colors in color-scheme configuration. When parsing named colors, treat semi-colons as string terminators, so we can properly parse named colors within the color-scheme configuration. --- src/terminal/named-colors.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/terminal/named-colors.c b/src/terminal/named-colors.c index b0e579b6..ab94153e 100644 --- a/src/terminal/named-colors.c +++ b/src/terminal/named-colors.c @@ -761,8 +761,13 @@ static int guac_terminal_named_color_search(const void* a, const void* b) { /* Skip any spaces in key (name will never have spaces) */ while (*key && isspace(*key)) key++; + /* Treat semi-colon as string terminator, to support parsing color + names within a larger string (e.g. within the terminal color-scheme + configuration string). */ + const int keyChar = (*key == ';') ? '\0' : tolower(*key); + /* Compare, ignoring case (name is already known to be lowercase) */ - int difference = tolower(*key) - *name; + int difference = keyChar - *name; if (difference) return difference;