-
-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance matrixShortcuts: Optional whitespace trimming & multi-selection support #391
Enhance matrixShortcuts: Optional whitespace trimming & multi-selection support #391
Conversation
0c271b2
to
82ae879
Compare
82ae879
to
4509ae0
Compare
ea07bcc
to
b645757
Compare
b645757
to
a9eb98b
Compare
// Take main cursor since ctx.mode takes the main cursor, weird behaviour is expected with multicursor because of this. | ||
if (key === "Tab" && view.state.selection.main.empty) { | ||
view.dispatch(view.state.replaceSelection(" & ")); | ||
trimWhitespace = settings.matrixShortcutsTrimWhitespace; | ||
|
||
if (key === "Tab") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shifting indentation when selecting something makes more sense then replacing the current selection with a &. Otherwise you can't change the indentation easily but you can replace the current selection by pressing & itself.
couldn't figure out how to review properly, sorry for the possible notifications
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good consideration. I will add && view.state.selection.main.empty
back, which means it’s based on the main selection. If there is a selection range in the main, it will indent; if there is no selection in the main, it will replace (regardless of other selections). But I’m also considering whether to change it so that if the selection is the entire line, it will indent, as some IDEs (like VS Code) handle it this way.
PR closed as it was replaced by another PR. #394 |
Summary
This PR adds an optional whitespace trimming feature to
matrixShortcuts
.Changes
matrixShortcutsTrimWhitespace
This feature is enabled by default and can be disabled in settings.