Skip to content

Commit 3b0e34e

Browse files
committed
Polished handling of empty script list in SCRIPTS mode
1 parent ea530fd commit 3b0e34e

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

bin/UI.ml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -745,13 +745,13 @@ module Bottom_pane = struct
745745
)
746746
| Scripts -> (
747747
(fun (_text, _x) ->
748-
Lwd.set text_field UI_base.empty_text_field;
749-
Nottui.Focus.release Vars.script_name_field_focus_handle;
750748
Option.iter (fun (_file, path) ->
749+
Lwd.set text_field UI_base.empty_text_field;
750+
Nottui.Focus.release Vars.script_name_field_focus_handle;
751751
Lwd.set UI_base.Vars.quit true;
752752
UI_base.Vars.action := Some (Open_script path);
753+
Lwd.set UI_base.Vars.input_mode Navigate;
753754
) selected_script_file_and_path;
754-
Lwd.set UI_base.Vars.input_mode Navigate;
755755
)
756756
)
757757
| _ -> failwith "unexpected case"
@@ -777,14 +777,9 @@ module Bottom_pane = struct
777777
Some (fun key (_text, _x) ->
778778
match key with
779779
| (`ASCII 'X', [`Ctrl]) -> (
780-
(match selected_script_file_and_path with
781-
| Some (file, path) -> (
782-
Lwd.set UI_base.Vars.input_mode (Delete_script_confirm (file, path))
783-
)
784-
| None -> (
785-
Lwd.set UI_base.Vars.input_mode Navigate
786-
)
787-
);
780+
Option.iter (fun (file, path) ->
781+
Lwd.set UI_base.Vars.input_mode (Delete_script_confirm (file, path))
782+
) selected_script_file_and_path;
788783
`Handled
789784
)
790785
| _ -> (

0 commit comments

Comments
 (0)