fix: scope composer key bindings to 'ovis-composer > Input'

Bindings on plain Input swallowed keys in every other mod's text field.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
FactorandClaude Sonnet 5.5 committed 2026-11-19 11:11:56 +01:00
1 parent 5761825ac8
commit 187a385f6f
1 file changed
+17 -16
+17 -16
View File
@@ -124,28 +124,29 @@ export default class Composer extends View {
}); });
this.handle = cx.focus_handle(); this.handle = cx.focus_handle();
// The keys the field swallows: it binds the arrows to the movement of the // The keys the field swallows: it binds the arrows and Tab to its own
// cursor, and it eats them before they reach the element. Ctrl+C is not // actions and eats them before they reach the element. Ctrl+C is not bound
// bound here - it stays "copy". The composer takes them as actions of its own - the app hands // here - it stays "copy". The composer takes these keys as actions of its
// every action named "<mod>.<command>" to the mod's nextCommand(). // own - the app hands every action named "<mod>.<command>" to the mod's
// nextCommand().
// //
// The bindings sit on the "Input" context - the context of a text field - // The keymap is application-wide, so a plain "Input" context would also
// so they only ever fire where a field has the keyboard. The composer's // match the text fields of other mods and swallow their keys. The
// own actions are bound deeper than the field's own ones, so the field's // bindings use the descendant predicate "ovis-composer > Input": only a
// actions would win and the composer would never hear of the key; the // field that sits inside the composer's own key context (see
// composer therefore gets the key first and the field gets what is left. // key_context(CONTEXT) on the root) matches.
// //
// What the composer does with the key depends on the keyboard: only the // What the composer does with the key depends on the keyboard: only the
// copy of the composer whose own field has the keyboard acts - the other // copy of the composer whose own field has the keyboard acts - the other
// copies (a composer in another pane) leave the key alone. // copies (a composer in another pane) leave the key alone.
cx.bind_keys([ cx.bind_keys([
{ keystroke: "up", action: "ovis-composer.up", context: "Input" }, { keystroke: "up", action: "ovis-composer.up", context: `${CONTEXT} > Input` },
{ keystroke: "down", action: "ovis-composer.down", context: "Input" }, { keystroke: "down", action: "ovis-composer.down", context: `${CONTEXT} > Input` },
{ keystroke: "tab", action: "ovis-composer.accept", context: "Input" }, { keystroke: "tab", action: "ovis-composer.accept", context: `${CONTEXT} > Input` },
{ keystroke: "ctrl-r", action: "ovis-composer.panel", context: "Input" }, { keystroke: "ctrl-r", action: "ovis-composer.panel", context: `${CONTEXT} > Input` },
{ keystroke: "ctrl-enter", action: "ovis-composer.send_now", context: "Input" }, { keystroke: "ctrl-enter", action: "ovis-composer.send_now", context: `${CONTEXT} > Input` },
{ keystroke: "alt-enter", action: "ovis-composer.hold", context: "Input" }, { keystroke: "alt-enter", action: "ovis-composer.hold", context: `${CONTEXT} > Input` },
{ keystroke: "escape", action: "ovis-composer.escape", context: "Input" }, { keystroke: "escape", action: "ovis-composer.escape", context: `${CONTEXT} > Input` },
]); ]);
// Focus follows the click: nothing here takes the keyboard on its own. // Focus follows the click: nothing here takes the keyboard on its own.