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.

fix bug making changes made when closed not show immediately on opening

+27 -18
+20 -9
jj_tui/bin/global_funcs.ml
··· 14 14 ;; 15 15 16 16 let check_startup () = 17 - match jj_no_log_errorable ~color:false ~snapshot:false [ "op";"log"; "-l";"0" ] with 18 - | Ok _ -> 19 - `Good 20 - | Error (`BadExit (i, str)) -> 21 - if str |> Base.String.is_substring ~substring:"There is no jj repo" 22 - then `NotInRepo 23 - else `OtherError str 24 - | Error (`Exception e) -> 25 - `CantStartProcess e 17 + let result = Lwd.var `Good in 18 + (* In the happy path making this a fiber and returning an Lwd.t makes this not delay rendering. In the unhappy path, after 150-50ms the error message will show*) 19 + Flock.fork (fun x -> 20 + let res = 21 + match 22 + (*we snapshot here in the first request to make sure the editor is showing the latest changes*) 23 + jj_no_log_errorable ~color:false ~snapshot:true [ "op"; "log"; "-l"; "0" ] 24 + with 25 + | Ok _ -> 26 + `Good 27 + | Error (`BadExit (i, str)) -> 28 + if str |> Base.String.is_substring ~substring:"There is no jj repo" 29 + then `NotInRepo 30 + else `OtherError str 31 + | Error (`Exception e) -> 32 + `CantStartProcess e 33 + in 34 + (*we don't want to trigger a re-render if the result is still good *) 35 + if res != Lwd.peek result then result $= res); 36 + result |> Lwd.get 26 37 ;; 27 38 28 39 (**Updates the status windows; Without snapshotting the working copy by default
+7 -9
jj_tui/bin/jj_ui.ml
··· 37 37 W.button (Printf.sprintf "quit ") (fun () -> Vars.quit $= true) |> Lwd.pure 38 38 ;; 39 39 40 - 41 40 let inputs ?(custom = fun _ -> `Unhandled) ui = 42 41 let$ input_state = Lwd.get ui_state.input 43 42 and$ ui = ui in ··· 46 45 match custom event with 47 46 | `Unhandled -> 48 47 (match event with 49 - | `Arrow (`Left), _ -> 50 - `Remap (`Focus `Up,[]) 51 - | `Arrow (`Right), _ -> 52 - `Remap (`Focus `Down,[]) 48 + | `Arrow `Left, _ -> 49 + `Remap (`Focus `Up, []) 50 + | `Arrow `Right, _ -> 51 + `Remap (`Focus `Down, []) 53 52 | `ASCII 'q', _ -> 54 53 Vars.quit $= true; 55 54 `Handled ··· 145 144 |> W.Overlay.selection_list_prompt_filterable 146 145 ~show_prompt_var:ui_state.show_string_selection_prompt 147 146 |> inputs ~custom:(function 148 - 149 147 | `Enter, [] -> 150 148 Focus.request_reversable summary_focus; 151 149 `Handled ··· 169 167 170 168 let mainUi () = 171 169 (*we want to initialize our states and keep them up to date*) 172 - match check_startup () with 170 + let$* startup_result = check_startup () in 171 + match startup_result with 173 172 | `Good -> 174 - (* update_status ~cause_snapshot:true (); *) 175 173 Flock.fork (fun () -> 176 174 while true do 177 175 Picos.Fiber.sleep ~seconds:5.0; 178 - (*we need to lock this becasue we could end up updating while the ui is rendering*) 179 176 update_status ~cause_snapshot:true () 177 + (*we need to lock this becasue we could end up updating while the ui is rendering*) 180 178 done; 181 179 ()); 182 180 let$* running = Lwd.get ui_state.view in