aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui/editor.rs
diff options
context:
space:
mode:
authorZheming Li2021-06-08 03:24:27 +0000
committerBlaž Hrastnik2021-06-08 08:27:21 +0000
commitae51065213c4dfc0072c9dfe384527faf34b54ff (patch)
treea72b1dabcfbe05636ac85dafd87043c902f46580 /helix-term/src/ui/editor.rs
parent4e3a3436025b7ae2677855de307f6016cb946509 (diff)
Support go to line 1
Diffstat (limited to 'helix-term/src/ui/editor.rs')
-rw-r--r--helix-term/src/ui/editor.rs7
1 files changed, 4 insertions, 3 deletions
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,