aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorMarkus F.X.J. Oberhumer2024-03-09 08:02:43 +0000
committerGitHub2024-03-09 08:02:43 +0000
commit0dc67ff8852ce99d40ad4464062ebe212b0b03a1 (patch)
tree280ab732ba7a15325e65827a3b2eab6687e9575a /helix-term
parente3c6c82828299f1728f16a8d8fcfa5c3603a3d47 (diff)
helix-term: allow to backspace out-of the command prompt (#9828)
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/ui/prompt.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs
index a6ee7f05..d46c1313 100644
--- a/helix-term/src/ui/prompt.rs
+++ b/helix-term/src/ui/prompt.rs
@@ -544,6 +544,10 @@ impl Component for Prompt {
(self.callback_fn)(cx, &self.line, PromptEvent::Update);
}
ctrl!('h') | key!(Backspace) | shift!(Backspace) => {
+ if self.line.is_empty() {
+ (self.callback_fn)(cx, &self.line, PromptEvent::Abort);
+ return close_fn;
+ }
self.delete_char_backwards(cx.editor);
(self.callback_fn)(cx, &self.line, PromptEvent::Update);
}