More long-press accents; number-row letters stay choices in full mode

- 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 <noreply@anthropic.com>
This commit is contained in:
2026-10-14 22:46:13 +02:00
co-authored by Claude Opus 5.5
parent ac67ceac18
commit 076bc14e2f
3 changed files with 27 additions and 19 deletions
+18 -12
View File
@@ -2,18 +2,24 @@
"id": "template", "id": "template",
"name": "Template", "name": "Template",
"alternates": { "alternates": {
"a": ["á", "à", "â", "ä", "æ", "ã", "å", "ā"], "a": ["á", "à", "â", "ä", "æ", "ã", "å", "ā", "ą", "ă", "ǎ"],
"c": ["ç", "ć", "č"], "c": ["ç", "ć", "č", "ĉ", "ċ"],
"d": ["ð"], "d": ["ď", "đ", "ð"],
"e": ["é", "è", "ê", "ë", "ē", "ė", "ę"], "e": ["é", "è", "ê", "ë", "ē", "ė", "ę", "ě", "ẽ"],
"i": ["í", "ì", "î", "ï", "ī", "į"], "g": ["ğ", "ĝ", "ģ", "ġ"],
"l": ["ł"], "h": ["ĥ", "ħ"],
"n": ["ñ", "ń"], "i": ["í", "ì", "î", "ï", "ī", "į", "ı", "ǐ"],
"o": ["ó", "ò", "ô", "ö", "õ", "ø", "œ", "ō"], "j": ["ĵ"],
"s": ["ß", "ś", "š"], "k": ["ķ"],
"t": ["þ"], "l": ["ł", "ľ", "ĺ", "ļ", "ŀ"],
"u": ["ú", "ù", "û", "ü", "ū"], "n": ["ñ", "ń", "ň", "ņ", "ŋ"],
"y": ["ý", "ÿ"], "o": ["ó", "ò", "ô", "ö", "õ", "ø", "œ", "ō", "ő", "ǒ"],
"r": ["ŕ", "ř"],
"s": ["ß", "ś", "š", "ş", "ș", "ŝ"],
"t": ["ť", "ţ", "ț", "þ"],
"u": ["ú", "ù", "û", "ü", "ū", "ů", "ű", "ų", "ŭ", "ǔ"],
"w": ["ŵ"],
"y": ["ý", "ÿ", "ŷ"],
"z": ["ž", "ź", "ż"] "z": ["ž", "ź", "ż"]
}, },
"sections": [ "sections": [
+6 -5
View File
@@ -101,14 +101,15 @@ Row expandPlaceholders(const Row &row, const KeymapKeys &keymap)
return result; return result;
} }
// Long-press choices per letter: the keymap's letters that have no key here // 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. // 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) void addAlternates(Layer &layer, const Layout &tmpl, const KeymapKeys &keymap)
{ {
QSet<QString> onKeys; QSet<QString> onKeys;
for (const Row &row : layer.rows) { for (int row = 0; row < 3; ++row) {
for (const KeyDef &key : row) for (const KeyDef &key : letterKeys(keymap, row, {}))
onKeys << key.label << key.shifted.toLower(); onKeys << key.label;
} }
QHash<QString, QStringList> choices; QHash<QString, QStringList> choices;
+3 -2
View File
@@ -132,8 +132,9 @@ private Q_SLOTS:
QCOMPARE(acute.deadShifted, quint32(XKB_KEY_dead_caron)); 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"\""); // as the physical key
QCOMPARE(letterKey(sk, u"ľ"_s).shifted, u"2"); QCOMPARE(letterKey(sk, u"ľ"_s).shifted, u"2");
// ľ has its own key now, so it's not a long-press choice on l. // Number-row letters are still long-press choices on their base letter.
QVERIFY(!letterKey(sk, u"l"_s).alternates.contains(u"ľ"_s)); QCOMPARE(letterKey(sk, u"t"_s).alternates.first(), u"ť");
QCOMPARE(letterKey(sk, u"l"_s).alternates.first(), u"ľ");
} }
void noPlaceholdersRemain() void noPlaceholdersRemain()