mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 20:03:05 +00:00
fix(coding-agent): use key helpers for arrow keys and Enter
Fixed arrow key and Enter detection in selector components to work with Kitty protocol when Caps Lock or Num Lock is enabled. Updated: oauth-selector, user-message-selector, hook-selector, hook-input, model-selector, session-selector
This commit is contained in:
parent
65c292b7dd
commit
8d1229b5ec
6 changed files with 45 additions and 21 deletions
|
|
@ -3,7 +3,7 @@
|
|||
* Displays a list of string options with keyboard navigation.
|
||||
*/
|
||||
|
||||
import { Container, isEscape, Spacer, Text } from "@mariozechner/pi-tui";
|
||||
import { Container, isArrowDown, isArrowUp, isEnter, isEscape, Spacer, Text } from "@mariozechner/pi-tui";
|
||||
import { theme } from "../theme/theme.js";
|
||||
import { DynamicBorder } from "./dynamic-border.js";
|
||||
|
||||
|
|
@ -67,17 +67,17 @@ export class HookSelectorComponent extends Container {
|
|||
|
||||
handleInput(keyData: string): void {
|
||||
// Up arrow or k
|
||||
if (keyData === "\x1b[A" || keyData === "k") {
|
||||
if (isArrowUp(keyData) || keyData === "k") {
|
||||
this.selectedIndex = Math.max(0, this.selectedIndex - 1);
|
||||
this.updateList();
|
||||
}
|
||||
// Down arrow or j
|
||||
else if (keyData === "\x1b[B" || keyData === "j") {
|
||||
else if (isArrowDown(keyData) || keyData === "j") {
|
||||
this.selectedIndex = Math.min(this.options.length - 1, this.selectedIndex + 1);
|
||||
this.updateList();
|
||||
}
|
||||
// Enter
|
||||
else if (keyData === "\r" || keyData === "\n") {
|
||||
else if (isEnter(keyData) || keyData === "\n") {
|
||||
const selected = this.options[this.selectedIndex];
|
||||
if (selected) {
|
||||
this.onSelectCallback(selected);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue