Skip to content

Add Emacs/readline editing mode#4270

Open
colonelpanic8 wants to merge 14 commits into
pingdotgg:mainfrom
colonelpanic8:t3code/add-emacs-readline-mode
Open

Add Emacs/readline editing mode#4270
colonelpanic8 wants to merge 14 commits into
pingdotgg:mainfrom
colonelpanic8:t3code/add-emacs-readline-mode

Conversation

@colonelpanic8

@colonelpanic8 colonelpanic8 commented Jul 22, 2026

Copy link
Copy Markdown

Summary

  • add a persisted client-local keyboard editing mode with Browser default and Emacs / readline options
  • support common readline movement, deletion, kill/yank, transpose, and word-navigation bindings across text inputs and contenteditable editors
  • make Control-N and Control-P navigate command palettes, comboboxes, selects, menus, and other candidate lists while the mode is active
  • preserve terminal-native key handling

Why

Browser text controls do not consistently provide Emacs/readline editing shortcuts across platforms, and candidate-selection surfaces only respond to arrow keys. This mode provides a consistent opt-in editing experience throughout T3 Code.

Validation

  • vp test run packages/contracts/src/settings.test.ts apps/web/src/emacsReadlineBindings.test.ts apps/web/src/AppRoot.test.tsx (39 tests)
  • targeted contracts and web type checks
  • targeted formatter and lint checks
  • isolated live web verification of mode persistence, Control-A, Control-E, Control-W, Control-Y, and Control-N/Control-P command-palette navigation

Note

Medium Risk
A global capture-phase keyboard listener and new precedence between readline chords, default shortcuts, and Lexical composer edits can change keyboard behavior app-wide when the mode is enabled.

Overview
Adds an opt-in keyboardEditingMode client setting (default vs Emacs / readline) in General settings, persisted through contracts and desktop client settings.

When Emacs mode is on, EmacsReadlineBindings registers a capture-phase keydown handler that applies readline chords to plain inputs, textareas, and generic contenteditable surfaces, maps Control-N/P to arrow navigation for open candidate pickers (with focus scoping), and skips terminals and keybinding-capture fields. Custom app shortcuts still win over readline via new resolveCustomShortcutCommand and optional source (default | user) on resolved keybindings; server runtime marks shipped defaults as default.

The Lexical composer gets a dedicated plugin that treats mention/skill chips as single logical characters, integrates kill/yank with chip reconstruction, and uses data-emacs-readline-managed so the global handler defers mutations to the editor.

Reviewed by Cursor Bugbot for commit 4189d3c. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add Emacs/readline editing mode for text inputs and the composer

  • Adds a new EmacsReadlineBindings component that registers a global capture-phase keydown listener, routing Ctrl/Alt chords through an Emacs/readline keybinding engine (emacsReadlineBindings.ts) for all text inputs, textareas, and contenteditable elements.
  • Implements grapheme-aware cursor movement, word/line navigation, kill/yank with a process-wide kill ring, transpose, and delete operations across plain text controls and contenteditable hosts.
  • Adds ComposerEmacsReadlinePlugin to the Lexical composer, treating inline mention/skill chips as single logical characters and integrating kill/yank with the kill ring; transpose across inline tokens is a no-op.
  • Adds a keyboardEditingMode setting ('default' | 'emacs') to ClientSettings, exposed in the General settings panel; Emacs mode is off by default.
  • Extends the keybinding system with a source field ('default' | 'user') on resolved rules and a resolveCustomShortcutCommand API so Emacs key chords can yield to explicit user-defined application shortcuts without conflicting with built-in defaults.

Macroscope summarized 4189d3c.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ad59c46b-e646-4d1f-afc4-5e380281ea3b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XL 500-999 changed lines (additions + deletions). labels Jul 22, 2026
Comment thread apps/web/src/emacsReadlineBindings.ts
Comment thread apps/web/src/emacsReadlineBindings.ts
Comment thread apps/web/src/emacsReadlineBindings.ts
Comment thread apps/web/src/emacsReadlineBindings.ts
Comment thread apps/web/src/emacsReadlineBindings.ts
Comment thread apps/web/src/emacsReadlineBindings.ts
Comment thread apps/web/src/emacsReadlineBindings.ts
Comment thread apps/web/src/emacsReadlineBindings.ts
@macroscopeapp

macroscopeapp Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR introduces a complete new feature (Emacs/readline editing mode) with ~2200 lines of new logic, new components, global event handling, and settings integration. New features of this scope warrant human review.

You can customize Macroscope's approvability policy. Learn more.

Comment thread apps/web/src/emacsReadlineBindings.ts
Comment thread apps/web/src/emacsReadlineBindings.ts
Comment thread apps/web/src/components/ComposerPromptEditor.tsx Outdated
Comment thread apps/web/src/emacsReadlineBindings.ts Outdated
Comment thread apps/web/src/emacsReadlineBindings.ts
Comment thread apps/web/src/emacsReadlineBindings.ts
Comment thread apps/web/src/components/ComposerPromptEditor.tsx Outdated
Comment thread apps/web/src/components/EmacsReadlineBindings.tsx
Comment thread apps/web/src/components/EmacsReadlineBindings.tsx
@colonelpanic8
colonelpanic8 force-pushed the t3code/add-emacs-readline-mode branch from ad28130 to 3d358f3 Compare July 22, 2026 14:50
@github-actions github-actions Bot added size:XXL 1,000+ changed lines (additions + deletions). and removed size:XL 500-999 changed lines (additions + deletions). labels Jul 22, 2026
Comment thread apps/web/src/components/ComposerPromptEditor.tsx
Comment thread apps/web/src/keybindings.ts
Comment thread apps/web/src/emacsReadlineBindings.ts Outdated
Comment thread apps/web/src/components/ComposerPromptEditor.tsx Outdated
Comment thread apps/web/src/components/ComposerPromptEditor.tsx
Comment thread apps/web/src/components/ComposerPromptEditor.tsx
Comment thread apps/web/src/emacsReadlineBindings.ts
Comment thread apps/web/src/emacsReadlineBindings.ts Outdated
Comment thread apps/web/src/composerEmacsReadline.ts
Comment thread apps/web/src/components/ComposerPromptEditor.tsx
Comment thread apps/web/src/components/ComposerPromptEditor.tsx
Comment thread apps/web/src/components/ComposerPromptEditor.tsx
@colonelpanic8
colonelpanic8 force-pushed the t3code/add-emacs-readline-mode branch from 66b4b63 to 2fefbf3 Compare July 22, 2026 15:45
Comment thread apps/web/src/components/ComposerPromptEditor.tsx
Comment thread apps/web/src/components/ComposerPromptEditor.tsx Outdated
Comment thread apps/web/src/emacsReadlineBindings.ts
Comment thread apps/web/src/emacsReadlineBindings.ts
@colonelpanic8
colonelpanic8 force-pushed the t3code/add-emacs-readline-mode branch from d3bfe6c to 048b91d Compare July 22, 2026 16:15

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 4 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 048b91d. Configure here.

Comment thread apps/web/src/emacsReadlineBindings.ts
Comment thread apps/web/src/emacsReadlineBindings.ts
Comment thread apps/web/src/composerEmacsReadline.ts
Comment thread apps/web/src/keybindings.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 1,000+ changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant