Skip to content

Commit

Permalink
Restore screen position when abort search (helix-editor#1047)
Browse files Browse the repository at this point in the history
  • Loading branch information
pickfire authored and EbbDrop committed Nov 11, 2021
1 parent 70ed999 commit 1bf1455
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions helix-term/src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub fn regex_prompt(
let (view, doc) = current!(cx.editor);
let view_id = view.id;
let snapshot = doc.selection(view_id).clone();
let offset_snapshot = view.offset;

Prompt::new(
prompt,
Expand All @@ -45,6 +46,7 @@ pub fn regex_prompt(
PromptEvent::Abort => {
let (view, doc) = current!(cx.editor);
doc.set_selection(view.id, snapshot.clone());
view.offset = offset_snapshot;
}
PromptEvent::Validate => {
// TODO: push_jump to store selection just before jump
Expand Down

0 comments on commit 1bf1455

Please sign in to comment.