fix: keep shared default shortcuts when resetting by tiensonqin · Pull Request #13172 · logseq/logseq · GitHub
Skip to content

fix: keep shared default shortcuts when resetting - #13172

Open
tiensonqin wants to merge 1 commit into
masterfrom
logseq/fix-shortcut-reset-shared-default-81eb
Open

fix: keep shared default shortcuts when resetting#13172
tiensonqin wants to merge 1 commit into
masterfrom
logseq/fix-shortcut-reset-shared-default-81eb

Conversation

@tiensonqin

Copy link
Copy Markdown
Contributor

Fixes db-test#1152.

Resetting a command that shares a default key (for example Backspace on Delete Backward and Delete Selected Block) no longer removes that key from the peer command that still uses the default.

What changed

compute-reset-plan still detects keys owned by other commands, but it now leaves keys that belong to the peer's default binding. Only user-customized collisions are stripped and persisted.

Tests

  • Resetting :editor/backspace does not strip Backspace from :editor/delete-selection
  • Resetting :editor/delete-selection does not strip shared defaults from :editor/backspace or :editor/delete
  • A user-assigned Backspace on a command that does not default to it is still cleared
Open in Web Open in Cursor 

Resetting a command no longer strips the restored default key from
peer commands that still use that key as a default (db-test#1152).
User-customized collisions are still cleared.

Co-authored-by: Tienson Qin <tiensonqin@gmail.com>
Copilot AI lite review requested due to automatic review settings September 5, 2026 16:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The logic change is localized, preserves intended shared-default behavior, and is covered by targeted tests for both shared-default and user-customized collision scenarios.

Pull request overview

This PR fixes shortcut reset behavior so that when two commands share the same default key binding, resetting one command no longer strips that shared default key from the other command’s binding.

Changes:

  • Add reset conflict logic that preserves keys that are part of the peer command’s default binding while still removing user-customized collisions.
  • Update compute-reset-plan to use the new conflict-update computation and to skip emitting conflict updates when nothing should be stripped.
  • Add CLJS tests covering shared-default preservation and user-customized collision stripping.
File summaries
File Description
src/main/frontend/components/shortcut.cljs Preserves shared default shortcut keys during reset by filtering conflict-stripping to user-customized collisions only.
src/test/frontend/components/shortcut_test.cljs Adds regression tests ensuring shared defaults survive reset while user-added collisions are still removed.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

Resetting a duplicate shortcut incorrectly removes the shortcut from another command

3 participants