terminal user interface to jujutsu. Focused on speed and clarity
9
fork

Configure Feed

Select the types of activity you want to include in your feed.

support sub-sub commands

+11 -7
+11 -7
jj_tui/bin/jj_commands.ml
··· 19 19 | Prompt of string * cmd_args 20 20 | Selection_prompt of 21 21 string 22 - * (unit-> 'a Nottui.W.Lists.selectable_item list Lwd.t) 22 + * (unit -> 'a Nottui.W.Lists.selectable_item list Lwd.t) 23 23 * (string -> 'a -> bool) 24 24 * ('a -> 'a command_variant) 25 25 | Prompt_r of string * cmd_args ··· 90 90 :: render_commands ~indent_level:(indent_level + 1) subs 91 91 ;; 92 92 93 - let commands_list_ui ?(include_arrows=false) commands = 93 + let commands_list_ui ?(include_arrows = false) commands = 94 94 let move_command = 95 95 render_command_line 96 96 ~indent_level:0 97 97 ("Alt+Arrows" |> String.to_seq |> Seq.map Uchar.of_char |> Array.of_seq) 98 98 "navigation between windows" 99 99 in 100 - (commands |> render_commands) @ (if include_arrows then [move_command] else[] ) 100 + ((commands |> render_commands) @ if include_arrows then [ move_command ] else []) 101 101 |> I.vcat 102 102 |> Ui.atom 103 103 |> Lwd.pure ··· 140 140 $= Some 141 141 W.Overlay. 142 142 { 143 - items=items() 143 + items = items () 144 144 ; filter_predicate 145 145 ; label = str 146 146 ; on_exit = ··· 205 205 (** Try mapching the command mapping to the provided key and run the command if it matches *) 206 206 and command_input ~is_sub keymap key = 207 207 (* Use exceptions so we can break out of the list*) 208 + let input = Lwd.peek ui_state.input in 208 209 try 209 210 keymap 210 211 |> List.iter (fun cmd -> ··· 212 213 `Unhandled 213 214 with 214 215 | Handled -> 215 - if is_sub then ui_state.input $= `Normal; 216 + (*If this is a sub command and we didn't change to some other subcommand we should exit back to normal command operation*) 217 + if is_sub && input == Lwd.peek ui_state.input then ui_state.input $= `Normal; 216 218 `Handled 217 219 | Jj_process.JJError (cmd, error) -> 218 220 handle_jj_error cmd error; ··· 249 251 ; cmd = 250 252 Fun 251 253 (fun _ -> 252 - ui_state.show_popup $= Some (commands_list_ui ~include_arrows:true default_list, "Help"); 254 + ui_state.show_popup 255 + $= Some (commands_list_ui ~include_arrows:true default_list, "Help"); 253 256 ui_state.input $= `Mode (fun _ -> `Unhandled)) 254 257 } 255 258 ] ··· 262 265 let confirm_prompt prompt cmd = 263 266 SubCmd [ { key = 'y'; description = "Yes I want to " ^ prompt; cmd } ] 264 267 ;; 268 + 265 269 (** Handles raw command mapping without regard for modes or the current intput state. Should be used when setting a new input mode*) 266 - let command_input=command_input;; 270 + let command_input = command_input 267 271 268 272 (** Handles input and sub_commands.*) 269 273 let handleInputs command_mapping =