aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands.rs
diff options
context:
space:
mode:
authorKyle Smith2023-03-08 01:53:31 +0000
committerGitHub2023-03-08 01:53:31 +0000
commitf4bdbe4674e6d023a63d2e64aec48c8c8598be67 (patch)
tree3304838b3566d86b950947bb9ddca6224492cc81 /helix-term/src/commands.rs
parent0c6d25acae86cf87356fd3b3b59a25904226e41b (diff)
Do not add intermediate lines to jumplist with :<linenum> command. (#5751)
* Do not add intermediate lines to jumplist with :<linenum> command. * Revert jumplist index changes. * Reduce calculations during update cycle. * Use jumplist for undo, set jumplist before preview. * remove some debug logging * Revert "remove some debug logging" This reverts commit 5772c4327e7121c53ea0726a4d7333ae1c413ffb. * Revert "Use jumplist for undo, set jumplist before preview." This reverts commit f73a1b29824feaf16477b9df547fb28d9db81923. * Add last_selection, update implementation. * @pascalkuthe initial feedback * Ensure ":goto 123" keybinding works as expected. * fix clippies, prefer expect() for expect last_selection state
Diffstat (limited to 'helix-term/src/commands.rs')
-rw-r--r--helix-term/src/commands.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index ebdfdfde..e09a1c5b 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -2828,10 +2828,15 @@ fn push_jump(view: &mut View, doc: &Document) {
}
fn goto_line(cx: &mut Context) {
- goto_line_impl(cx.editor, cx.count)
+ if cx.count.is_some() {
+ let (view, doc) = current!(cx.editor);
+ push_jump(view, doc);
+
+ goto_line_without_jumplist(cx.editor, cx.count);
+ }
}
-fn goto_line_impl(editor: &mut Editor, count: Option<NonZeroUsize>) {
+fn goto_line_without_jumplist(editor: &mut Editor, count: Option<NonZeroUsize>) {
if let Some(count) = count {
let (view, doc) = current!(editor);
let text = doc.text().slice(..);
@@ -2848,7 +2853,6 @@ fn goto_line_impl(editor: &mut Editor, count: Option<NonZeroUsize>) {
.clone()
.transform(|range| range.put_cursor(text, pos, editor.mode == Mode::Select));
- push_jump(view, doc);
doc.set_selection(view.id, selection);
}
}