aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src/ui/mod.rs')
-rw-r--r--helix-term/src/ui/mod.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs
index ca133b66..cb1b36fa 100644
--- a/helix-term/src/ui/mod.rs
+++ b/helix-term/src/ui/mod.rs
@@ -39,9 +39,8 @@ pub fn regex_prompt(
move |editor: &mut Editor, input: &str, event: PromptEvent| {
match event {
PromptEvent::Abort => {
- // TODO: also revert doc
// TODO: also revert text
- let doc = &mut editor.view_mut().doc;
+ let doc = &mut editor.view().doc.borrow_mut();
doc.set_selection(snapshot.clone());
}
PromptEvent::Validate => {
@@ -56,13 +55,15 @@ pub fn regex_prompt(
match Regex::new(input) {
Ok(regex) => {
let view = &mut editor.view_mut();
- let doc = &mut view.doc;
+ let mut doc = view.doc.borrow_mut();
// revert state to what it was before the last update
// TODO: also revert text
doc.set_selection(snapshot.clone());
- fun(doc, regex);
+ fun(&mut doc, regex);
+
+ drop(doc);
view.ensure_cursor_in_view();
}