vim: Fix 1G

Before this change code could not distinguish between a user providing a
count of 1 and no count at all.

Fixes: zed-industries/community#710
This commit is contained in:
Conrad Irwin 2023-06-21 22:36:48 -06:00
parent 5291bf3d9f
commit 0cacf01f90
8 changed files with 49 additions and 26 deletions

View file

@ -238,13 +238,12 @@ impl Vim {
popped_operator
}
fn pop_number_operator(&mut self, cx: &mut WindowContext) -> usize {
let mut times = 1;
fn pop_number_operator(&mut self, cx: &mut WindowContext) -> Option<usize> {
if let Some(Operator::Number(number)) = self.active_operator() {
times = number;
self.pop_operator(cx);
return Some(number);
}
times
None
}
fn clear_operator(&mut self, cx: &mut WindowContext) {