From 8cc7a023906a283b91b84bd790106500497779aa Mon Sep 17 00:00:00 2001 From: Mikayla Date: Wed, 20 Sep 2023 08:30:37 -0700 Subject: [PATCH] Fix rebase --- assets/keymaps/default.json | 1 - crates/editor/src/editor.rs | 26 ++++++++++++++++++-------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/assets/keymaps/default.json b/assets/keymaps/default.json index 2fa5c0980f3d45e7acc62f218967c2327dadeea5..68fe4b997e8be04406711e6b933edcef63c6d6a3 100644 --- a/assets/keymaps/default.json +++ b/assets/keymaps/default.json @@ -454,7 +454,6 @@ "context": "Editor", "bindings": { "ctrl-shift-k": "editor::DeleteLine", - // "cmd-shift-d": "editor::DuplicateLine", "cmd-shift-l": "editor::SplitSelectionIntoLines", "ctrl-j": "editor::JoinLines", "ctrl-cmd-up": "editor::MoveLineUp", diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index cc4af44a1a8f2bbd5b2f5188f85519581b09c724..455088a5137256a578e35c16c66cae2e26a333ce 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -5958,7 +5958,7 @@ impl Editor { display_map: &DisplaySnapshot, replace_newest: bool, cx: &mut ViewContext, - ) { + ) -> Result<()> { fn select_next_match_ranges( this: &mut Editor, range: Range, @@ -5996,7 +5996,6 @@ impl Editor { ); 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 offset_range = start_offset + query_match.start()..start_offset + query_match.end(); @@ -6057,18 +6056,22 @@ impl Editor { wordwise: false, done: false, }); - self.select_next(action, cx)?; + self.select_next_match_internal(display_map, replace_newest, cx)?; } } Ok(()) } - pub fn select_all_matches(&mut self, action: &SelectAllMatches, cx: &mut ViewContext) { + pub fn select_all_matches( + &mut self, + action: &SelectAllMatches, + cx: &mut ViewContext, + ) -> Result<()> { self.push_to_selection_history(); let display_map = self.display_map.update(cx, |map, cx| map.snapshot(cx)); 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 .select_next_state @@ -6079,15 +6082,22 @@ impl Editor { break; } } + + Ok(()) } - pub fn select_next(&mut self, action: &SelectNext, cx: &mut ViewContext) { + pub fn select_next(&mut self, action: &SelectNext, cx: &mut ViewContext) -> Result<()> { self.push_to_selection_history(); 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) { + pub fn select_previous( + &mut self, + action: &SelectPrevious, + cx: &mut ViewContext, + ) -> Result<()> { self.push_to_selection_history(); let display_map = self.display_map.update(cx, |map, cx| map.snapshot(cx)); let buffer = &display_map.buffer_snapshot;