Keep the switching order when changing input methods

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
David Heinemeier HanssonandClaude Opus 5.5 committed 2026-10-10 23:10:52 +09:00
1 parent 7b260bed17
commit d1e96fd86d
2 files changed
+11 -5

No files matched your search

+5 -4
View File
@@ -82,11 +82,12 @@ def input_catalog(items):
def input_items(items, selected, overrides=None):
keyboard = [item for item in items if item[0].startswith("keyboard-")]
if not keyboard:
if not any(item[0].startswith("keyboard-") for item in items):
raise RuntimeError("The current input group has no keyboard input")
existing = {**(overrides or {}), **dict(items)}
return keyboard + [[name, existing.get(name, "")] for name in selected]
# Retained entries keep their switching order; new engines follow them.
kept = [item for item in items if item[0].startswith("keyboard-") or item[0] in selected]
current = dict(items)
return kept + [[name, (overrides or {}).get(name, "")] for name in selected if name not in current]
def set_inputs(group, layout, before, after):