aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r--helix-term/src/ui/editor.rs4
-rw-r--r--helix-term/src/ui/mod.rs9
2 files changed, 6 insertions, 7 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index e8cd40cf..52cf3d2b 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -710,7 +710,7 @@ impl EditorView {
// debug_assert!(cxt.count != 0);
// set the register
- cxt.selected_register = cxt.editor.selected_register.take();
+ cxt.register = cxt.editor.selected_register.take();
self.handle_keymap_event(mode, cxt, event);
if self.keymaps.pending().is_empty() {
@@ -887,9 +887,9 @@ impl EditorView {
impl Component for EditorView {
fn handle_event(&mut self, event: Event, cx: &mut Context) -> EventResult {
let mut cxt = commands::Context {
- selected_register: helix_view::RegisterSelection::default(),
editor: &mut cx.editor,
count: None,
+ register: None,
callback: None,
on_next_key_callback: None,
jobs: cx.jobs,
diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs
index 0a1e24b5..07eef352 100644
--- a/helix-term/src/ui/mod.rs
+++ b/helix-term/src/ui/mod.rs
@@ -20,7 +20,6 @@ pub use spinner::{ProgressSpinners, Spinner};
pub use text::Text;
use helix_core::regex::Regex;
-use helix_core::register::Registers;
use helix_view::{Document, Editor, View};
use std::path::PathBuf;
@@ -28,7 +27,8 @@ use std::path::PathBuf;
pub fn regex_prompt(
cx: &mut crate::commands::Context,
prompt: std::borrow::Cow<'static, str>,
- fun: impl Fn(&mut View, &mut Document, &mut Registers, Regex) + 'static,
+ history_register: Option<char>,
+ fun: impl Fn(&mut View, &mut Document, Regex) + 'static,
) -> Prompt {
let (view, doc) = current!(cx.editor);
let view_id = view.id;
@@ -36,7 +36,7 @@ pub fn regex_prompt(
Prompt::new(
prompt,
- None,
+ history_register,
|_input: &str| Vec::new(), // this is fine because Vec::new() doesn't allocate
move |cx: &mut crate::compositor::Context, input: &str, event: PromptEvent| {
match event {
@@ -56,12 +56,11 @@ pub fn regex_prompt(
match Regex::new(input) {
Ok(regex) => {
let (view, doc) = current!(cx.editor);
- let registers = &mut cx.editor.registers;
// revert state to what it was before the last update
doc.set_selection(view.id, snapshot.clone());
- fun(view, doc, registers, regex);
+ fun(view, doc, regex);
view.ensure_cursor_in_view(doc, cx.editor.config.scrolloff);
}