Add Emacs/readline editing mode#4270
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
ApprovabilityVerdict: Needs human review This PR introduces a new user-facing feature (Emacs/readline editing mode) with ~2500 lines of new code across multiple new files, new keyboard event handling, and new settings. New capabilities of this scope warrant human review. You can customize Macroscope's approvability policy. Learn more. |
ad28130 to
3d358f3
Compare
66b4b63 to
2fefbf3
Compare
d3bfe6c to
048b91d
Compare
4189d3c to
cdb8647
Compare
85d1678 to
d897c39
Compare
6df7aa7 to
cf68c34
Compare
25dd0ec to
4401e9d
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4401e9d. Configure here.
| $isRangeSelection(selection) && getSelectionRangeForComposerOffsets(selection) !== null; | ||
| }); | ||
| } | ||
| rootElement?.toggleAttribute("data-emacs-readline-ready", ready); |
There was a problem hiding this comment.
Composer readiness uses stale root
Medium Severity
ComposerEmacsReadlinePlugin captures editor.getRootElement() once and writes data-emacs-readline-ready on that snapshot, without registerRootListener (used elsewhere in this file). If the root is null at effect time or later replaced, readiness never attaches. Capture then sees a managed host that is not ready and returns without handling, so composer-focused readline chords fall through to app shortcuts.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 4401e9d. Configure here.
| '[data-slot="select-popup"]', | ||
| '[data-slot="menu-popup"]', | ||
| '[role="listbox"]', | ||
| ].join(","); |
There was a problem hiding this comment.
Model picker list not selected
Medium Severity
CANDIDATE_SURFACE_SELECTOR matches portaled combobox-popup and command-list, but the model picker’s inline list only exposes data-slot="combobox-list". Candidate detection then depends solely on a generic role="listbox" match. If that role is absent or hidden, Control-N/P are applied as line motion on the single-line search input, consumed, and never move the model highlight.
Reviewed by Cursor Bugbot for commit 4401e9d. Configure here.


Summary
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
Exact-head evidence
Revalidated at 4189d3c on current main (9a0a071): focused tests, vp check, and vp run typecheck passed. The capture uses only disposable local projects.
Note
Medium Risk
Global capture-phase key handling can shadow browser or app shortcuts when emacs mode is on; composer Lexical mutations add regression surface for chips and prompt sync.
Overview
Adds an opt-in keyboard editing mode (
default|emacs) on client settings, with a General settings control and restore-defaults support.When Emacs / readline is enabled, a capture-phase
EmacsReadlineBindingshost applies readline chords to plain inputs, generic contenteditables, and the Lexical composer viaComposerEmacsReadlinePlugin, including kill/yank that keeps mention/skill chips and terminal context placeholders. Ctrl-N / Ctrl-P move focus in open candidate surfaces (composer command menu, comboboxes, etc.) instead of only arrow keys; terminals and keybinding-capture fields are excluded.Keybindings gain optional
source(default|user) through contracts, server persistence, and compilation.resolveCustomShortcutCommandlets readline consume chords that match built-in defaults while still yielding to custom or explicitly user shortcuts (withwhencontext from terminal/preview/model picker state). Settings reset/save paths passsourceso default vs custom rows stay accurate.Reviewed by Cursor Bugbot for commit 4401e9d. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add Emacs/readline editing mode to the composer and global keybinding system
EmacsReadlineBindingscomponent (mounted inAppRoot) that intercepts keydown events globally and applies Emacs/readline chords (Ctrl-A/E/B/F/K/U/W/Y, Alt-B/F/D, transpose-chars, etc.) to focused inputs, textareas, and contenteditables.ComposerEmacsReadlinePlugininside the rich-text composer that maps readline actions onto Lexical nodes, preserving mention/skill chips and terminal context placeholders during kill/yank and movement.keyboardEditingModesetting ('default'|'emacs') toClientSettingsand exposes a selector in the General settings panel so users can enable or reset the mode.sourcefield ('default'|'user') across contracts, server persistence, and runtime compilation, enablingresolveCustomShortcutCommandto skip defaults when checking for application-shortcut precedence over readline chords.Macroscope summarized 4401e9d.