Skip to content

Added sensible keybindings to DraftState#92

Open
themamiza wants to merge 2 commits into
webstonehq:mainfrom
themamiza:main
Open

Added sensible keybindings to DraftState#92
themamiza wants to merge 2 commits into
webstonehq:mainfrom
themamiza:main

Conversation

@themamiza

Copy link
Copy Markdown

This adds missing draft shortcuts that are common for text editing.

Added delete_word_backward to DraftState and introduced DraftAction so adding more draft shortcuts is easier and cleaner.

Ctrl-Backspace (passed as Ctrl-h) and Ctrl-w delete the previous word, Ctrl-a moves the cursor to the beginning of the line and
Ctrl-e moves the cursor to the end of the line.

themamiza added 2 commits July 9, 2026 04:56
`delete_word_backward` added to DraftState helpers
Add a `DraftAction` layer that maps raw key events into draft editing
operations before applying them to the draft.
This makes shortcut handling reusable as more bindings are added.

Common keybindings have been added:
C-a -> Move to the beginning of the line
C-e -> Move to the end of the line
C-w, C-h -> Delete word backward
@mikenikles

Copy link
Copy Markdown
Contributor

From what I can tell, #75 covers that. Could you double-check and let me know if it satisfies what you added here 🙏?

@themamiza

Copy link
Copy Markdown
Author

Yes that implementation is pretty much it, except that Ctrl-h (which is passed when doing Ctrl-Backspace) should be mapped to DeleteWordBackward as that's the correct behavior in emacs and most other editors (same behavior as Ctrl-w).
It would really be appreciated if that's also fixed.
Everything else seems fine and is actually more thorough than what I've written.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants