From ae51065213c4dfc0072c9dfe384527faf34b54ff Mon Sep 17 00:00:00 2001 From: Zheming Li Date: Tue, 8 Jun 2021 03:24:27 +0000 Subject: Support go to line 1 --- helix-term/src/ui/editor.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'helix-term/src/ui/editor.rs') diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 92913701..00305fc8 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -527,7 +527,8 @@ impl EditorView { // count handling key!(i @ '0'..='9') => { let i = i.to_digit(10).unwrap() as usize; - cxt.editor.count = Some(cxt.editor.count.map_or(i, |c| c * 10 + i)); + cxt.editor.count = + std::num::NonZeroUsize::new(cxt.editor.count.map_or(i, |c| c.get() * 10 + i)); } // special handling for repeat operator key!('.') => { @@ -540,7 +541,7 @@ impl EditorView { } _ => { // set the count - cxt.count = cxt.editor.count.take().unwrap_or(1); + cxt._count = cxt.editor.count.take(); // TODO: edge case: 0j -> reset to 1 // if this fails, count was Some(0) // debug_assert!(cxt.count != 0); @@ -587,8 +588,8 @@ impl Component for EditorView { let mut cxt = commands::Context { register: helix_view::RegisterSelection::default(), - count: 1, editor: &mut cx.editor, + _count: None, callback: None, on_next_key_callback: None, callbacks: cx.callbacks, -- cgit v1.2.3-70-g09d2