Fix rebase

This commit is contained in:
Mikayla 2023-09-20 08:30:37 -07:00
parent 03d4191685
commit 8cc7a02390
No known key found for this signature in database
2 changed files with 18 additions and 9 deletions

View file

@ -454,7 +454,6 @@
"context": "Editor", "context": "Editor",
"bindings": { "bindings": {
"ctrl-shift-k": "editor::DeleteLine", "ctrl-shift-k": "editor::DeleteLine",
// "cmd-shift-d": "editor::DuplicateLine",
"cmd-shift-l": "editor::SplitSelectionIntoLines", "cmd-shift-l": "editor::SplitSelectionIntoLines",
"ctrl-j": "editor::JoinLines", "ctrl-j": "editor::JoinLines",
"ctrl-cmd-up": "editor::MoveLineUp", "ctrl-cmd-up": "editor::MoveLineUp",

View file

@ -5958,7 +5958,7 @@ impl Editor {
display_map: &DisplaySnapshot, display_map: &DisplaySnapshot,
replace_newest: bool, replace_newest: bool,
cx: &mut ViewContext<Self>, cx: &mut ViewContext<Self>,
) { ) -> Result<()> {
fn select_next_match_ranges( fn select_next_match_ranges(
this: &mut Editor, this: &mut Editor,
range: Range<usize>, range: Range<usize>,
@ -5996,7 +5996,6 @@ impl Editor {
); );
for (start_offset, query_match) in query_matches { for (start_offset, query_match) in query_matches {
(start_offset, &query_match);
let query_match = query_match.unwrap(); // can only fail due to I/O let query_match = query_match.unwrap(); // can only fail due to I/O
let offset_range = let offset_range =
start_offset + query_match.start()..start_offset + query_match.end(); start_offset + query_match.start()..start_offset + query_match.end();
@ -6057,18 +6056,22 @@ impl Editor {
wordwise: false, wordwise: false,
done: false, done: false,
}); });
self.select_next(action, cx)?; self.select_next_match_internal(display_map, replace_newest, cx)?;
} }
} }
Ok(()) Ok(())
} }
pub fn select_all_matches(&mut self, action: &SelectAllMatches, cx: &mut ViewContext<Self>) { pub fn select_all_matches(
&mut self,
action: &SelectAllMatches,
cx: &mut ViewContext<Self>,
) -> Result<()> {
self.push_to_selection_history(); self.push_to_selection_history();
let display_map = self.display_map.update(cx, |map, cx| map.snapshot(cx)); let display_map = self.display_map.update(cx, |map, cx| map.snapshot(cx));
loop { loop {
self.select_next_match_internal(&display_map, action.replace_newest, cx); self.select_next_match_internal(&display_map, action.replace_newest, cx)?;
if self if self
.select_next_state .select_next_state
@ -6079,15 +6082,22 @@ impl Editor {
break; break;
} }
} }
Ok(())
} }
pub fn select_next(&mut self, action: &SelectNext, cx: &mut ViewContext<Self>) { pub fn select_next(&mut self, action: &SelectNext, cx: &mut ViewContext<Self>) -> Result<()> {
self.push_to_selection_history(); self.push_to_selection_history();
let display_map = self.display_map.update(cx, |map, cx| map.snapshot(cx)); let display_map = self.display_map.update(cx, |map, cx| map.snapshot(cx));
self.select_next_match_internal(&display_map, action.replace_newest, cx); self.select_next_match_internal(&display_map, action.replace_newest, cx)?;
Ok(())
} }
pub fn select_previous(&mut self, action: &SelectPrevious, cx: &mut ViewContext<Self>) { pub fn select_previous(
&mut self,
action: &SelectPrevious,
cx: &mut ViewContext<Self>,
) -> Result<()> {
self.push_to_selection_history(); self.push_to_selection_history();
let display_map = self.display_map.update(cx, |map, cx| map.snapshot(cx)); let display_map = self.display_map.update(cx, |map, cx| map.snapshot(cx));
let buffer = &display_map.buffer_snapshot; let buffer = &display_map.buffer_snapshot;