-
Notifications
You must be signed in to change notification settings - Fork 2
feat: best-in-class multi-line input editor (replaces readline) #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
agjs
wants to merge
18
commits into
main
Choose a base branch
from
feat/multiline-editor
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
2906380
docs(editor): design spec for the multi-line input editor
agjs dd17751
docs(editor): implementation plan for the multi-line editor (11 tasks…
agjs 2b8eee1
feat(editor): EditorBuffer core text model (grapheme-aware insert/new…
agjs 681e7cf
feat(editor): word/line/doc navigation + sticky-column vertical moves
agjs e3ad37d
feat(editor): kill-ring + word/line/to-edge deletes with yank/yank-pop
agjs 3a2c786
feat(editor): coalesced undo/redo
agjs 7da333a
fix: yank produces single undo snapshot, not double
agjs dd4c346
feat(editor): large-paste markers with expand-on-submit
agjs f013837
feat(editor): key decoder (Kitty CSI-u + modifyOtherKeys + legacy, En…
agjs 6fc045d
feat(editor): finalize PasteScanner (timeout valve + tmux CSI-u decode)
agjs 07e082f
chore(editor): move paste.ts under editor/ (consistent module layout)
agjs 386829b
feat(editor): EditorView multi-line renderer (wrap + scroll + cursor)
agjs 9116bb4
fix(editor): resolve row counting and cursor offset bugs
agjs fda7204
feat(editor): EditorController (raw stdin glue, submit/newline/paste …
agjs d7636be
feat(cli): drive the interactive prompt through the multi-line editor…
agjs f3d7030
fix(editor-cli): fix dual stdin/raw-mode conflict + history/Ctrl-C/pa…
agjs 4e16b5b
fix(repl): reduce cognitive complexity + add editor controller tests
agjs 61d57e9
docs(editor): document the multi-line input editor + keys
agjs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| --- | ||
| title: Input Editor | ||
| description: Multi-line input editor keybindings, paste handling, and fallback mode. | ||
| --- | ||
|
|
||
| The Dreamdata Platform's CLI uses an interactive multi-line input editor for the REPL session. It supports full keyboard navigation, history recall, word deletion, and multi-line paste. | ||
|
|
||
| ## Submit vs. newline | ||
|
|
||
| | Key | Behavior | | ||
| | --- | --- | | ||
| | **Enter** | Submit message to the agent | | ||
| | **Shift+Enter** | Insert newline in buffer | | ||
| | **Alt+Enter** | Insert newline in buffer | | ||
| | **`\` then Enter** | Insert newline (remove the trailing backslash) | | ||
|
|
||
| When you press Enter with an empty buffer or at the top level, your message is submitted. To write multiple lines, use Shift+Enter, Alt+Enter, or end a line with a backslash and press Enter. | ||
|
|
||
| ## Navigation and editing | ||
|
|
||
| ### Motion | ||
| | Key | Action | | ||
| | --- | --- | | ||
| | **←/→** | Move cursor left/right (one character) | | ||
| | **Ctrl+← / Ctrl+→** | Move by word | | ||
| | **Home / End** | Move to start/end of current line | | ||
| | **Ctrl+Home / Ctrl+End** | Move to start/end of entire buffer | | ||
| | **↑/↓** | Recall input history (at buffer edges only) | | ||
|
|
||
| ### Deletion | ||
| | Key | Action | | ||
| | --- | --- | | ||
| | **Backspace** | Delete character before cursor | | ||
| | **Delete** | Delete character at cursor | | ||
| | **Ctrl+W** | Delete word before cursor | | ||
| | **Alt+Backspace** | Delete word before cursor (alias) | | ||
| | **Ctrl+U** | Delete to start of line | | ||
| | **Ctrl+K** | Delete to end of line | | ||
|
|
||
| ### Kill ring (copy/paste buffer) | ||
| | Key | Action | | ||
| | --- | --- | | ||
| | **Ctrl+Y** | Yank (paste) last deleted text | | ||
| | **Alt+Y** | Yank-pop (rotate through deleted text) | | ||
|
|
||
| ### Undo | ||
| | Key | Action | | ||
| | --- | --- | | ||
| | **Ctrl+_** (Ctrl+underscore) | Undo last change | | ||
|
|
||
| ## History navigation | ||
|
|
||
| When your cursor is at the **top** of the buffer (line 0, any column), press **↑** to recall the previous submitted message. When at the **bottom** (last line), press **↓** to scroll forward through history. The draft you were typing is preserved and restored when you exit history. | ||
|
|
||
| ## Multi-line paste | ||
|
|
||
| Paste a block of text with Ctrl+V (or ⌘V on macOS). The pasted content lands in the buffer as-is and may span multiple lines. You can edit it like any buffer text. When you press Enter, the entire buffer (including pasted lines) is submitted as a single message. | ||
|
|
||
| Very large pastes are displayed as `[paste #N +M lines]` in the UI and expand to their full content when sent. | ||
|
|
||
| ## Command palette and file picker | ||
|
|
||
| | Key | Action | | ||
| | --- | --- | | ||
| | **`/`** | Open command palette (when buffer contains only `/`) | | ||
| | **`@`** | Open file picker (when buffer contains only `@`) | | ||
|
|
||
| Typing `/` or `@` followed by other text inserts those characters normally. | ||
|
|
||
| ## Keyboard interrupt | ||
|
|
||
| | Key | Action | | ||
| | --- | --- | | ||
| | **Ctrl+C** | Interrupt the current model run (does not exit the session) | | ||
| | **Ctrl+D** | Exit the CLI (on empty buffer only) | | ||
|
|
||
| ## Fallback: basic input mode | ||
|
|
||
| If the multi-line editor has compatibility issues, you can fall back to simple single-line (readline) input: | ||
|
|
||
| ```bash | ||
| TSFORGE_BASIC_INPUT=1 tsforge | ||
| ``` | ||
|
|
||
| This mode still accepts slash commands and works in pipes, but does not support Shift+Enter, multi-line paste, or kill-ring operations. | ||
|
|
||
| ## Terminal compatibility | ||
|
|
||
| The editor auto-detects your terminal's keyboard encoding (Kitty CSI-u, xterm modifyOtherKeys, or legacy). Resizing your terminal window updates the editor immediately. On non-TTY streams (pipes, files, CI), the editor is automatically skipped and replaced by line-buffered stdin reading. | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct the copy-paste brand reference from 'The Dreamdata Platform's CLI' to 'The tsforge CLI'.