Move if statement further up
This commit is contained in:
parent
35477d9d99
commit
55f3f6c60f
2 changed files with 8 additions and 10 deletions
|
@ -231,14 +231,8 @@ impl Vim {
|
|||
count = count.saturating_sub(1)
|
||||
}
|
||||
self.search.count = 1;
|
||||
// If search was initiated with vim shortcut '/', focus on editor, else if initiated
|
||||
// via standard search shortcut, keep search bar focused (and always move by count=1).
|
||||
if self.search.vim_mode_search {
|
||||
search_bar.select_match(direction, count, window, cx);
|
||||
search_bar.focus_editor(&Default::default(), window, cx);
|
||||
} else {
|
||||
search_bar.select_match(direction, 1, window, cx);
|
||||
}
|
||||
search_bar.select_match(direction, count, window, cx);
|
||||
search_bar.focus_editor(&Default::default(), window, cx);
|
||||
|
||||
let prior_selections: Vec<_> = self.search.prior_selections.drain(..).collect();
|
||||
let prior_mode = self.search.prior_mode;
|
||||
|
|
|
@ -336,8 +336,12 @@ pub fn init(cx: &mut App) {
|
|||
.and_then(|item| item.act_as::<Editor>(cx))
|
||||
.and_then(|editor| editor.read(cx).addon::<VimAddon>().cloned());
|
||||
let Some(vim) = vim else { return };
|
||||
vim.entity.update(cx, |_, cx| {
|
||||
cx.defer_in(window, |vim, window, cx| vim.search_submit(window, cx))
|
||||
vim.entity.update(cx, |vim, cx| {
|
||||
if vim.search.vim_mode_search {
|
||||
cx.defer_in(window, |vim, window, cx| vim.search_submit(window, cx))
|
||||
} else {
|
||||
cx.propagate()
|
||||
}
|
||||
})
|
||||
});
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue