perf: batch queued cursor navigation events
This commit is contained in:
@@ -2964,6 +2964,45 @@ impl Editor {
|
||||
self.active.view.mode
|
||||
}
|
||||
}
|
||||
/// Direct document motions can share a frame without bypassing key dispatch.
|
||||
pub(crate) fn can_batch_navigation(&self, input: &Input) -> bool {
|
||||
matches!(self.active.view.mode, Mode::Normal | Mode::Visual)
|
||||
&& self.document_actions_available()
|
||||
&& self.startup_diagnostic.is_none()
|
||||
&& self.hover.is_none()
|
||||
&& self.palette.is_none()
|
||||
&& self.completion.is_none()
|
||||
&& !self
|
||||
.file_picker
|
||||
.as_ref()
|
||||
.is_some_and(|picker| picker.focused)
|
||||
&& self.sequence_pending().is_none()
|
||||
&& !self.g_pending
|
||||
&& self.line_pending.is_none()
|
||||
&& self.seek_pending.is_none()
|
||||
&& matches!(
|
||||
self.bindings
|
||||
.get(&self.active.view.mode)
|
||||
.and_then(|keys| keys.get(input)),
|
||||
Some(Binding::Action(
|
||||
Action::Left
|
||||
| Action::Right
|
||||
| Action::Down
|
||||
| Action::Up
|
||||
| Action::LineStart
|
||||
| Action::LineEnd
|
||||
| Action::DocumentStart
|
||||
| Action::DocumentEnd
|
||||
| Action::GoToLine
|
||||
| Action::WordNext
|
||||
| Action::WordPrevious
|
||||
| Action::WordEnd
|
||||
| Action::BigWordNext
|
||||
| Action::BigWordPrevious
|
||||
| Action::BigWordEnd
|
||||
))
|
||||
)
|
||||
}
|
||||
|
||||
pub fn diff_editable(&self) -> bool {
|
||||
self.diff
|
||||
|
||||
Reference in New Issue
Block a user