Commit Graph

4 Commits

  • refactor: use configurable keybindings for all UI hints (#724)
    Follow-up to #717. Replaces all remaining hardcoded keybinding hints with configurable ones.
    
    - Add pasteImage to AppAction so it can be configured in keybindings.json
    - Create keybinding-hints.ts with reusable helper functions:
      - editorKey(action) / appKey(keybindings, action) - get key display string
      - keyHint(action, desc) / appKeyHint(kb, action, desc) / rawKeyHint(key, desc) - styled hints
    - Export helpers from components/index.ts for extensions
    - Update all components to use configured keybindings
    - Remove now-unused getDisplayString() from KeybindingsManager and EditorKeybindingsManager
    - Use keybindings.matches() instead of matchesKey() for pasteImage in custom-editor.ts
  • fix: use configurable expandTools keybinding instead of hardcoded ctrl+o (#717)
    - Add expandTools to EditorAction in pi-tui so components can access it
    - Update bash-execution, compaction-summary-message, branch-summary-message,
      and tool-execution to use getEditorKeybindings().getKeys('expandTools')
    - Pass expandTools config to setEditorKeybindings in KeybindingsManager.create()
    - Style keybinding with 'dim' color, description with 'muted' (matches startup hints)
  • feat: configurable keybindings for all editor and app actions
    All keybindings configurable via ~/.pi/agent/keybindings.json
    
    Editor actions:
    - cursorUp, cursorDown, cursorLeft, cursorRight
    - cursorWordLeft, cursorWordRight, cursorLineStart, cursorLineEnd
    - deleteCharBackward, deleteCharForward, deleteWordBackward
    - deleteToLineStart, deleteToLineEnd
    - newLine, submit, tab
    - selectUp, selectDown, selectConfirm, selectCancel
    
    App actions:
    - interrupt, clear, exit, suspend
    - cycleThinkingLevel, cycleModelForward, cycleModelBackward
    - selectModel, expandTools, toggleThinking, externalEditor
    
    Also adds support for numpad Enter key (Kitty protocol codepoint 57414
    and SS3 M sequence)
    
    Example emacs-style keybindings.json:
    {
      "cursorUp": ["up", "ctrl+p"],
      "cursorDown": ["down", "ctrl+n"],
      "cursorLeft": ["left", "ctrl+b"],
      "cursorRight": ["right", "ctrl+f"],
      "deleteCharForward": ["delete", "ctrl+d"],
      "cycleModelForward": "ctrl+o"
    }