From 076bc14e2f9b12625165b5cffc1701850c52d260 Mon Sep 17 00:00:00 2001 From: ericek111 Date: Wed, 14 Oct 2026 22:46:13 +0200 Subject: [PATCH] More long-press accents; number-row letters stay choices in full mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Template alternates cover Central/Eastern European, Turkish, Romanian, Baltic, Nordic and Esperanto letters, at most 11 per key - Only letters on the letter rows are skipped as choices, so sk ť, ľ, š… are offered on their base letter in full mode too Co-Authored-By: Claude Opus 5.5 --- layouts/template.json | 30 ++++++++++++++++++------------ src/layout/LayoutBuilder.cpp | 11 ++++++----- tests/tst_layoutbuilder.cpp | 5 +++-- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/layouts/template.json b/layouts/template.json index 1d60dda..2815adf 100644 --- a/layouts/template.json +++ b/layouts/template.json @@ -2,18 +2,24 @@ "id": "template", "name": "Template", "alternates": { - "a": ["á", "à", "â", "ä", "æ", "ã", "å", "ā"], - "c": ["ç", "ć", "č"], - "d": ["ð"], - "e": ["é", "è", "ê", "ë", "ē", "ė", "ę"], - "i": ["í", "ì", "î", "ï", "ī", "į"], - "l": ["ł"], - "n": ["ñ", "ń"], - "o": ["ó", "ò", "ô", "ö", "õ", "ø", "œ", "ō"], - "s": ["ß", "ś", "š"], - "t": ["þ"], - "u": ["ú", "ù", "û", "ü", "ū"], - "y": ["ý", "ÿ"], + "a": ["á", "à", "â", "ä", "æ", "ã", "å", "ā", "ą", "ă", "ǎ"], + "c": ["ç", "ć", "č", "ĉ", "ċ"], + "d": ["ď", "đ", "ð"], + "e": ["é", "è", "ê", "ë", "ē", "ė", "ę", "ě", "ẽ"], + "g": ["ğ", "ĝ", "ģ", "ġ"], + "h": ["ĥ", "ħ"], + "i": ["í", "ì", "î", "ï", "ī", "į", "ı", "ǐ"], + "j": ["ĵ"], + "k": ["ķ"], + "l": ["ł", "ľ", "ĺ", "ļ", "ŀ"], + "n": ["ñ", "ń", "ň", "ņ", "ŋ"], + "o": ["ó", "ò", "ô", "ö", "õ", "ø", "œ", "ō", "ő", "ǒ"], + "r": ["ŕ", "ř"], + "s": ["ß", "ś", "š", "ş", "ș", "ŝ"], + "t": ["ť", "ţ", "ț", "þ"], + "u": ["ú", "ù", "û", "ü", "ū", "ů", "ű", "ų", "ŭ", "ǔ"], + "w": ["ŵ"], + "y": ["ý", "ÿ", "ŷ"], "z": ["ž", "ź", "ż"] }, "sections": [ diff --git a/src/layout/LayoutBuilder.cpp b/src/layout/LayoutBuilder.cpp index cb2ba57..d0d25b0 100644 --- a/src/layout/LayoutBuilder.cpp +++ b/src/layout/LayoutBuilder.cpp @@ -101,14 +101,15 @@ Row expandPlaceholders(const Row &row, const KeymapKeys &keymap) return result; } -// Long-press choices per letter: the keymap's letters that have no key here -// first (they're what this language types), then the template's. +// Long-press choices per letter: the keymap's letters that have no letter key +// first (they're what this language types), then the template's. Letters on the +// number row (sk: ť) stay choices in full mode too: they're out of the way there. void addAlternates(Layer &layer, const Layout &tmpl, const KeymapKeys &keymap) { QSet onKeys; - for (const Row &row : layer.rows) { - for (const KeyDef &key : row) - onKeys << key.label << key.shifted.toLower(); + for (int row = 0; row < 3; ++row) { + for (const KeyDef &key : letterKeys(keymap, row, {})) + onKeys << key.label; } QHash choices; diff --git a/tests/tst_layoutbuilder.cpp b/tests/tst_layoutbuilder.cpp index b212924..6a44eef 100644 --- a/tests/tst_layoutbuilder.cpp +++ b/tests/tst_layoutbuilder.cpp @@ -132,8 +132,9 @@ private Q_SLOTS: QCOMPARE(acute.deadShifted, quint32(XKB_KEY_dead_caron)); QCOMPARE(letterKey(sk, u"ô"_s).shifted, u"\""); // as the physical key QCOMPARE(letterKey(sk, u"ľ"_s).shifted, u"2"); - // ľ has its own key now, so it's not a long-press choice on l. - QVERIFY(!letterKey(sk, u"l"_s).alternates.contains(u"ľ"_s)); + // Number-row letters are still long-press choices on their base letter. + QCOMPARE(letterKey(sk, u"t"_s).alternates.first(), u"ť"); + QCOMPARE(letterKey(sk, u"l"_s).alternates.first(), u"ľ"); } void noPlaceholdersRemain()