aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2022-06-06 15:08:47 +0000
committerBlaž Hrastnik2022-06-06 15:23:40 +0000
commitb14c258a2c447b892c89d3e68ef4c9a74effca85 (patch)
tree0e88e735936e48c2c82e4525fc957b3548995777 /helix-core/src
parent8351a82c2cae58dd49c654d0e878c9d7227ef9c8 (diff)
prompt: If submitting empty prompt, use default (last used)
Diffstat (limited to 'helix-core/src')
-rw-r--r--helix-core/src/register.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/helix-core/src/register.rs b/helix-core/src/register.rs
index b39e4034..7fa34644 100644
--- a/helix-core/src/register.rs
+++ b/helix-core/src/register.rs
@@ -69,6 +69,10 @@ impl Registers {
self.get(name).map(|reg| reg.read())
}
+ pub fn first(&self, name: char) -> Option<&String> {
+ self.read(name).and_then(|entries| entries.first())
+ }
+
pub fn inner(&self) -> &HashMap<char, Register> {
&self.inner
}