From 84a98ab7c282d0c58c6424f5755f8bc901ae4de8 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 7 Dec 2014 17:25:53 +0100 Subject: mds-kbdc: compile-keyboard: ,:s in < > are not special when inside quotes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/mds-kbdc/compile-layout.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/mds-kbdc/compile-layout.c b/src/mds-kbdc/compile-layout.c index ea10b05..3f96aba 100644 --- a/src/mds-kbdc/compile-layout.c +++ b/src/mds-kbdc/compile-layout.c @@ -943,6 +943,7 @@ static char32_t* parse_keys(mds_kbdc_tree_t* restrict tree, const char* restrict buf[buf_ptr++] = (char)(((1ULL << 31) ^ VAL##ULL) & 255); \ } \ while (0) + /* Actually, UTF-8 does not suppot beyond plane 16 nowadays, but we ignore that. */ mds_kbdc_tree_t* old_last_value_statement = last_value_statement; const char* restrict raw_ = raw++; @@ -953,7 +954,7 @@ static char32_t* parse_keys(mds_kbdc_tree_t* restrict tree, const char* restrict char* restrict old_buf = NULL; size_t rc_ptr = 0, rc_size = 0, n; size_t buf_ptr = 0, buf_size = 0; - int escape = 0; + int escape = 0, quote = 0; char c; int saved_errno; @@ -979,8 +980,15 @@ static char32_t* parse_keys(mds_kbdc_tree_t* restrict tree, const char* restrict STORE; escape = 1; } - else if (c == ',') SPECIAL(1); - else if (c == '"') SPECIAL(2); + else if ((c == ',') && !quote) + /* Sequence in key-combination. */ + SPECIAL(1); + else if (c == '"') + { + /* String in key-combination. */ + quote ^= 1; + SPECIAL(2); + } else { /* Buffer UTF-8 text for convertion to UTF-32. */ -- cgit v1.2.3-70-g09d2