Fix select all bugs (#3001)

Release Notes:

- Restore `cmd-shift-d` as 'editor::DuplicateLine' and move
`editor::SelectAllMatches` to `cmd-shift-L`, like in VS Code. The
previous action for `cmd-shift-l`, `editor::SplitSelectionIntoLines`,
has been moved to the sublime base keymap.
- Fixes a panic when using 'editor::SelectAllMatches'  on an empty line.
This commit is contained in:
Max Brunsfeld
2023-09-20 17:21:10 -07:00
committed by GitHub
3 changed files with 6 additions and 3 deletions
+2 -2
View File
@@ -303,7 +303,7 @@
"replace_newest": false
}
],
"cmd-shift-d": "editor::SelectAllMatches",
"cmd-shift-l": "editor::SelectAllMatches",
"ctrl-cmd-d": [
"editor::SelectPrevious",
{
@@ -463,7 +463,7 @@
"context": "Editor",
"bindings": {
"ctrl-shift-k": "editor::DeleteLine",
"cmd-shift-l": "editor::SplitSelectionIntoLines",
"cmd-shift-d": "editor::DuplicateLine",
"ctrl-j": "editor::JoinLines",
"ctrl-cmd-up": "editor::MoveLineUp",
"ctrl-cmd-down": "editor::MoveLineDown",
+1
View File
@@ -17,6 +17,7 @@
"ctrl-shift-down": "editor::AddSelectionBelow",
"cmd-shift-space": "editor::SelectAll",
"ctrl-shift-m": "editor::SelectLargerSyntaxNode",
"cmd-shift-l": "editor::SplitSelectionIntoLines",
"cmd-shift-a": "editor::SelectLargerSyntaxNode",
"shift-f12": "editor::FindAllReferences",
"alt-cmd-down": "editor::GoToDefinition",
+3 -1
View File
@@ -6048,10 +6048,12 @@ impl Editor {
let query = buffer
.text_for_range(selection.start..selection.end)
.collect::<String>();
let is_empty = query.is_empty();
let select_state = SelectNextState {
query: AhoCorasick::new(&[query])?,
wordwise: true,
done: false,
done: is_empty,
};
select_next_match_ranges(
self,