Skip to content

Commit

Permalink
Restore screen position when abort search (#1047)
Browse files Browse the repository at this point in the history
  • Loading branch information
pickfire authored Nov 10, 2021
1 parent 7c9f620 commit 97893cc
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 97893cc

Please sign in to comment.