diff options
author | Blaž Hrastnik | 2021-03-18 06:07:02 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-03-18 06:07:02 +0000 |
commit | c331721565a00850849e0a99fd325ae281bfb800 (patch) | |
tree | 9645238dc5900e77426e44ecbd4d9e47250d3a1d /helix-term/src/ui | |
parent | 8ba1e15d296fd3350332d8fa372c4c7703024a67 (diff) |
Finish hiding doc.state / State as an implementation detail.
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r-- | helix-term/src/ui/mod.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs index f2376504..f7ba59cd 100644 --- a/helix-term/src/ui/mod.rs +++ b/helix-term/src/ui/mod.rs @@ -31,7 +31,7 @@ pub fn regex_prompt( prompt: String, fun: impl Fn(&mut Document, Regex) + 'static, ) -> Prompt { - let snapshot = cx.doc().state.clone(); + let snapshot = cx.doc().selection().clone(); Prompt::new( prompt, @@ -39,9 +39,10 @@ pub fn regex_prompt( move |editor: &mut Editor, input: &str, event: PromptEvent| { match event { PromptEvent::Abort => { - // revert state + // TODO: also revert doc + // TODO: also revert text let doc = &mut editor.view_mut().doc; - doc.state = snapshot.clone(); + doc.set_selection(snapshot.clone()); } PromptEvent::Validate => { // @@ -58,7 +59,8 @@ pub fn regex_prompt( let doc = &mut view.doc; // revert state to what it was before the last update - doc.state = snapshot.clone(); + // TODO: also revert text + doc.set_selection(snapshot.clone()); fun(doc, regex); |