Skip to content

feat(keyboard): Ctrl+Alt+Up/Down to cycle editable messages#869

Open
Just-Insane wants to merge 4 commits into
SableClient:devfrom
Just-Insane:feat/edit-message-keybind
Open

feat(keyboard): Ctrl+Alt+Up/Down to cycle editable messages#869
Just-Insane wants to merge 4 commits into
SableClient:devfrom
Just-Insane:feat/edit-message-keybind

Conversation

@Just-Insane
Copy link
Copy Markdown
Contributor

@Just-Insane Just-Insane commented May 19, 2026

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

AI disclosure:

  • Partially AI assisted (clarify which code was AI assisted and briefly explain what it does).
  • Fully AI generated (explain what all the generated code does in moderate detail).

A keydown listener intercepts Ctrl+Alt+ArrowUp and Ctrl+Alt+ArrowDown, filters the room timeline for m.room.message events 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.

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).
@Just-Insane Just-Insane marked this pull request as ready for review May 19, 2026 23:15
@Just-Insane Just-Insane requested review from 7w1 and hazre as code owners May 19, 2026 23:15
Copilot AI review requested due to automatic review settings May 19, 2026 23:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 roomIdToEditNavRequestAtomFamily atom carrying { dir, nonce } for cross-component edit-navigation signaling.
  • Global key handler in GlobalKeyboardShortcuts.tsx for Ctrl+Alt+Up/Down that sets the request on the current room.
  • RoomTimeline.tsx effect that filters editable messages, walks a cursor based on editId, and calls handleEdit.

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.

Comment thread src/app/features/room/RoomTimeline.tsx Outdated
Comment thread src/app/features/room/RoomTimeline.tsx
Comment thread src/app/components/GlobalKeyboardShortcuts.tsx Outdated
- 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
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