feat(keyboard): Ctrl+Alt+Up/Down to cycle editable messages#869
Open
Just-Insane wants to merge 4 commits into
Open
feat(keyboard): Ctrl+Alt+Up/Down to cycle editable messages#869Just-Insane wants to merge 4 commits into
Just-Insane wants to merge 4 commits into
Conversation
Adds Ctrl+Alt+Up / Ctrl+Alt+Down keyboard shortcuts to navigate through
the current user's own editable messages, mirroring the existing
Ctrl+Up / Ctrl+Down reply navigation.
Implementation:
- roomInputDrafts.ts: new IEditNavRequest atom family
(roomIdToEditNavRequestAtomFamily) used as a one-shot signal between
GlobalKeyboardShortcuts and RoomTimeline.
- GlobalKeyboardShortcuts.tsx: intercepts mod+alt+up/down, bumps a nonce
and writes a { dir, nonce } request to the atom.
- RoomTimeline.tsx: watches the atom; on change navigates editId to the
prev/next editable message in the processed timeline (or starts at the
most recent if none is active).
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Ctrl+Alt+Up/Down keyboard shortcuts to cycle through the local user's recent editable messages in the active room. GlobalKeyboardShortcuts writes a per-room navigation request (direction + nonce) to a new Jotai atomFamily, and RoomTimeline reacts to that atom to advance a cursor through the user's own message events and invokes the existing edit handler.
Changes:
- New
roomIdToEditNavRequestAtomFamilyatom carrying{ dir, nonce }for cross-component edit-navigation signaling. - Global key handler in
GlobalKeyboardShortcuts.tsxforCtrl+Alt+Up/Downthat sets the request on the current room. RoomTimeline.tsxeffect that filters editable messages, walks a cursor based oneditId, and callshandleEdit.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/app/state/room/roomInputDrafts.ts |
Adds the IEditNavRequest type and atomFamily used to signal edit-cycle requests per room. |
src/app/components/GlobalKeyboardShortcuts.tsx |
Wires the new Ctrl+Alt+Up/Down hotkeys to set a nonce-stamped request on the current room's atom. |
src/app/features/room/RoomTimeline.tsx |
Consumes the request, filters the local user's m.room.message events, and advances the edit cursor. |
.changeset/edit-message-keybind.md |
Minor-level changeset entry describing the new shortcut. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Reset editNavRequest atom to undefined after consuming it so repeat keystrokes don't no-op - Use canEditEvent() helper instead of manual sender/type check to correctly filter by msgtype and relation type - Replace '' sentinel key with a stable no-op atom in GlobalKeyboardShortcuts to avoid polluting roomIdToEditNavRequestAtomFamily with a spurious empty-string entry
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Add keyboard shortcuts (Ctrl+Alt+Up / Ctrl+Alt+Down) to cycle through the current user's recent editable messages in the active room, without needing to reach for the mouse.
Fixes #
Type of change
Checklist:
AI disclosure:
A
keydownlistener interceptsCtrl+Alt+ArrowUpandCtrl+Alt+ArrowDown, filters the room timeline form.room.messageevents sent by the local user that are within the editable window, and walks a cursor index through that filtered list. The selected event ID is passed to the existing edit-message handler.