Fix final cursor positions on hotkeys#4809
Draft
Gazook89 wants to merge 3 commits into
Draft
Conversation
Final selection is the whole new text, which allows pressing the hotkey multiple times on the same bit of text to increase the amount of space (rather than just adding more snippets of text). Works on the reverse "remove space" hotkey as well.
Using hotkeys on selected text wraps text in braces, and leaves cursor position ready to add attributes (class, styles, etc) to newly created element. Unwrapping removes the braces and cursor is ready to continue typing at end of string. Specifically does *not* ever leave string fully selected to prevent accidentally overwriting/deleting that content.
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
Revisits the keymaps/hotkeys/shortcuts to adjust the final cursor position/selection after snippets are added. Since the editor update, snippets like
new pageare leaving their cursors at the start of the snippet string, which is annoying because then you need to move your cursor via keyboard or mouse to where you likely want it (in the case of new page, you want the cursor on that new page).This PR doesn't yet hit every existing keymap. Either it can sit and wallow until I do all of them, or just take this small chunk and throw it live. Here is what it has:
I do also have my own version of the wrapSelection function in the keymaps that apparently is a hot topic right now. I'm spinning that into it's own PR.
To-Do
[alt](url)? Or just theurlpart? Is it more important to allow quickly toggling the link syntax entirely, off and on? Or to create the link syntax and then be ready to type the URL, or the alt text?Related Issues or Discussions
QA Instructions, Screenshots, Recordings
Will update out of draft status.
### Reviewer Checklist
Replace the list below with specific features you want reviewers to look at.
*Reviewers, refer to this list when testing features, or suggest new items *