File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -715,7 +715,10 @@ fn theme(
715
715
cx. editor . unset_theme_preview ( ) ;
716
716
}
717
717
PromptEvent :: Update => {
718
- if let Some ( theme_name) = args. first ( ) {
718
+ if args. is_empty ( ) {
719
+ // Ensures that a preview theme gets cleaned up if the user backspaces until the prompt is empty.
720
+ cx. editor . unset_theme_preview ( ) ;
721
+ } else if let Some ( theme_name) = args. first ( ) {
719
722
if let Ok ( theme) = cx. editor . theme_loader . load ( theme_name) {
720
723
if !( true_color || theme. is_16_color ( ) ) {
721
724
bail ! ( "Unsupported theme: theme requires true color support" ) ;
Original file line number Diff line number Diff line change @@ -293,6 +293,7 @@ impl Prompt {
293
293
register : char ,
294
294
direction : CompletionDirection ,
295
295
) {
296
+ ( self . callback_fn ) ( cx, & self . line , PromptEvent :: Abort ) ;
296
297
let register = cx. editor . registers . get_mut ( register) . read ( ) ;
297
298
298
299
if register. is_empty ( ) {
@@ -314,6 +315,7 @@ impl Prompt {
314
315
self . history_pos = Some ( index) ;
315
316
316
317
self . move_end ( ) ;
318
+ ( self . callback_fn ) ( cx, & self . line , PromptEvent :: Update ) ;
317
319
self . recalculate_completion ( cx. editor ) ;
318
320
}
319
321
@@ -564,13 +566,11 @@ impl Component for Prompt {
564
566
ctrl ! ( 'p' ) | key ! ( Up ) => {
565
567
if let Some ( register) = self . history_register {
566
568
self . change_history ( cx, register, CompletionDirection :: Backward ) ;
567
- ( self . callback_fn ) ( cx, & self . line , PromptEvent :: Update ) ;
568
569
}
569
570
}
570
571
ctrl ! ( 'n' ) | key ! ( Down ) => {
571
572
if let Some ( register) = self . history_register {
572
573
self . change_history ( cx, register, CompletionDirection :: Forward ) ;
573
- ( self . callback_fn ) ( cx, & self . line , PromptEvent :: Update ) ;
574
574
}
575
575
}
576
576
key ! ( Tab ) => {
You can’t perform that action at this time.
0 commit comments