Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--helix-term/src/commands.rs20
-rw-r--r--helix-view/src/info.rs4
2 files changed, 18 insertions, 6 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 19a22601..f3753768 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -5544,7 +5544,10 @@ fn wonly(cx: &mut Context) {
}
fn select_register(cx: &mut Context) {
- cx.editor.autoinfo = Some(Info::from_registers(&cx.editor.registers));
+ cx.editor.autoinfo = Some(Info::from_registers(
+ "Select register",
+ &cx.editor.registers,
+ ));
cx.on_next_key(move |cx, event| {
cx.editor.autoinfo = None;
if let Some(ch) = event.char() {
@@ -5554,7 +5557,10 @@ fn select_register(cx: &mut Context) {
}
fn insert_register(cx: &mut Context) {
- cx.editor.autoinfo = Some(Info::from_registers(&cx.editor.registers));
+ cx.editor.autoinfo = Some(Info::from_registers(
+ "Insert register",
+ &cx.editor.registers,
+ ));
cx.on_next_key(move |cx, event| {
cx.editor.autoinfo = None;
if let Some(ch) = event.char() {
@@ -5571,7 +5577,10 @@ fn insert_register(cx: &mut Context) {
}
fn copy_between_registers(cx: &mut Context) {
- cx.editor.autoinfo = Some(Info::from_registers(&cx.editor.registers));
+ cx.editor.autoinfo = Some(Info::from_registers(
+ "Copy from register",
+ &cx.editor.registers,
+ ));
cx.on_next_key(move |cx, event| {
cx.editor.autoinfo = None;
@@ -5585,7 +5594,10 @@ fn copy_between_registers(cx: &mut Context) {
};
let values: Vec<_> = values.map(|value| value.to_string()).collect();
- cx.editor.autoinfo = Some(Info::from_registers(&cx.editor.registers));
+ cx.editor.autoinfo = Some(Info::from_registers(
+ "Copy into register",
+ &cx.editor.registers,
+ ));
cx.on_next_key(move |cx, event| {
cx.editor.autoinfo = None;
diff --git a/helix-view/src/info.rs b/helix-view/src/info.rs
index 7fc43f22..d1e90b5a 100644
--- a/helix-view/src/info.rs
+++ b/helix-view/src/info.rs
@@ -57,13 +57,13 @@ impl Info {
}
}
- pub fn from_registers(registers: &Registers) -> Self {
+ pub fn from_registers(title: impl Into<Cow<'static, str>>, registers: &Registers) -> Self {
let body: Vec<_> = registers
.iter_preview()
.map(|(ch, preview)| (ch.to_string(), preview))
.collect();
- let mut infobox = Self::new("Registers", &body);
+ let mut infobox = Self::new(title, &body);
infobox.width = 30; // copied content could be very long
infobox
}