diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-12-07 17:25:53 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-12-07 17:28:22 +0100 |
commit | 84a98ab7c282d0c58c6424f5755f8bc901ae4de8 (patch) | |
tree | 923bead446991f2496a350d570c441518a56217a | |
parent | mds-kbdc: compile-layout: support " in < > (diff) | |
download | mds-84a98ab7c282d0c58c6424f5755f8bc901ae4de8.tar.gz mds-84a98ab7c282d0c58c6424f5755f8bc901ae4de8.tar.bz2 mds-84a98ab7c282d0c58c6424f5755f8bc901ae4de8.tar.xz |
mds-kbdc: compile-keyboard: ,:s in < > are not special when inside quotes
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/mds-kbdc/compile-layout.c | 14 |
1 files 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. */ |