From f4bdbe4674e6d023a63d2e64aec48c8c8598be67 Mon Sep 17 00:00:00 2001 From: Kyle Smith Date: Tue, 7 Mar 2023 20:53:31 -0500 Subject: Do not add intermediate lines to jumplist with : command. (#5751) * Do not add intermediate lines to jumplist with : 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--- helix-view/src/editor.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'helix-view') diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 50da3dde..b96eec8d 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -40,12 +40,12 @@ use anyhow::{anyhow, bail, Error}; pub use helix_core::diagnostic::Severity; pub use helix_core::register::Registers; -use helix_core::Position; use helix_core::{ auto_pairs::AutoPairs, syntax::{self, AutoPairConfig}, Change, }; +use helix_core::{Position, Selection}; use helix_dap as dap; use helix_lsp::lsp; @@ -848,7 +848,12 @@ pub struct Editor { /// The currently applied editor theme. While previewing a theme, the previewed theme /// is set here. pub theme: Theme, - pub last_line_number: Option, + + /// The primary Selection prior to starting a goto_line_number preview. This is + /// restored when the preview is aborted, or added to the jumplist when it is + /// confirmed. + pub last_selection: Option, + pub status_msg: Option<(Cow<'static, str>, Severity)>, pub autoinfo: Option, @@ -964,7 +969,7 @@ impl Editor { syn_loader, theme_loader, last_theme: None, - last_line_number: None, + last_selection: None, registers: Registers::default(), clipboard_provider: get_clipboard_provider(), status_msg: None, -- cgit v1.2.3-70-g09d2