Restore Replace shortcut and document Move Line in shortcuts modal - #4255
Restore Replace shortcut and document Move Line in shortcuts modal#4255NisargJasani0602 wants to merge 3 commits into
Conversation
|
Quick note before this gets reviewed — I want to flag something I noticed after implementing this. Ctrl+F (already bound to openSearchPanel) opens the same search panel that already includes the Replace field and buttons built in — there's no separate "replace mode" in CodeMirror 6's search UI. So the Ctrl+H/Cmd+Alt+F binding added here doesn't unlock any new functionality; it's just an additional key combo that calls the exact same openSearchPanel function Ctrl+F already calls. I still think there's a reasonable case for keeping it (it restores what the pre-CM6 editor explicitly had, and the shortcuts modal has been advertising a dedicated Replace shortcut since before I touched anything, so this closes a documented promise), but it's also fair to call it redundant — one keystroke away either way, and the Mac binding (Cmd+Alt+F) is a little awkward specifically because Cmd+H is OS-reserved. Two ways to go from here: Keep this PR as-is (dedicated Replace shortcut). |
|
Hi @NisargJasani0602 thank you for the PR! Apologies on the delay. I think we recently updated the find/replace modal a bit so you may need to either update the logic for pulling up the replace modal (which is both find/replace but now the replace is hidden by default so you could add logic to pull it up with replace opened) or just changing the keyboard shortcut to document them as one command. |
…uts-modal-sync # Conflicts: # client/modules/IDE/components/Editor/utils/keymaps.js
The dedicated Replace keybinding (Ctrl-h/Cmd-Alt-f) was removed upstream when the custom SearchPanel replaced CodeMirror's built-in search UI; Replace is now a toggle inside the Find panel instead of a separate shortcut.
|
Thanks for the pointer! I've merged in the recent develop changes and updated this PR:
Also kept the Move Line Up/Down documentation from the original PR. |
Summary
Partial fix for #4253 (keyboard shortcuts modal out of sync with actual
keybindings). Covers two of the items identified there:
Ctrl+Hon Windows/Linux,Cmd+Alt+Fon Mac — matching Sublime and the pre-CM6 config). This was a genuine regression from the CM5 -> CM6 migration, not just a documentation gap: the old editor explicitly bound this via CM5'sreplacecommand, and the modal already advertised the correct platform-specific combo, but nothing implemented it. Fixed by wiring it to CodeMirror 6'sopenSearchPanel, whose panel already includes Replace/Replace All fields built in.Scope note
While auditing the modal against the actual keymap, I found several more real gaps (a phantom "Comment Line" shortcut that isn't implemented, and several working-but-undocumented shortcuts like select-next-occurrence, multi-cursor, delete-line, go-to-line, etc).
Keeping those out of this PR to stay reviewable — tracking as a follow-up.
Test plan
npm run lintpassesnpm test -- client/modules/IDE/components/EditorpassesCmd+Alt+Fopensthe search panel with Replace fields; the modal shows the new
Move Line Up/Down entries
I have verified that this pull request:
npm run lint)npm run test)npm run typecheck)developbranch.Fixes #123