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.

Avoid pointless updates

+36 -4
+21
jj_tui/bin/global_funcs.ml
··· 2 2 open Lwd_infix 3 3 open Jj_process.Make (Global_vars.Vars) 4 4 open Picos_std_structured 5 + open Jj_tui.Logging 5 6 6 7 let colored_string = Jj_tui.AnsiReverse.colored_string 7 8 ··· 50 51 This should be called after any command that performs a change *) 51 52 let update_views ?(cause_snapshot = false) () = 52 53 safe_jj (fun () -> 54 + [%log debug "updating views"]; 53 55 let rev = Vars.get_hovered_rev () in 54 56 let branches = 55 57 jj_no_log ~snapshot:cause_snapshot [ "bookmark"; "list"; "-a" ] |> colored_string ··· 74 76 let comp = Flock.fork_as_promise (fun () -> update_views ~cause_snapshot ()) in 75 77 current_computation := comp 76 78 ;; 79 + 80 + let last_op_id = ref "" 81 + 82 + (** Update all the jj views, if there has been some kind of change*) 83 + let update_if_changed () = 84 + (* If the last op_id has changed then there has been a change somewhere and we should re-render. otherwise don't bother*) 85 + [%log info "Checking if there has been a change to the repo"]; 86 + let this_op = 87 + jj_no_log 88 + ~color:false 89 + ~snapshot:true 90 + [ "op"; "log"; "--limit"; "1"; "-T"; "self.id()"; "--no-graph" ] 91 + in 92 + if !last_op_id <> this_op 93 + then ( 94 + [%log info "updating ui state becasue of a change in the repo"]; 95 + last_op_id := this_op; 96 + update_status ()) 97 + ;;
+1 -2
jj_tui/bin/jj_ui.ml
··· 193 193 Flock.fork (fun () -> 194 194 while true do 195 195 Picos.Fiber.sleep ~seconds:5.0; 196 - update_status ~cause_snapshot:true () 197 - (*we need to lock this becasue we could end up updating while the ui is rendering*) 196 + update_if_changed () 198 197 done; 199 198 ()); 200 199 let$* running = Lwd.get ui_state.view in
+2 -2
jj_tui/bin/show_view.ml
··· 108 108 anything, obviously this is important"]); 109 109 current_loading_computation 110 110 := Flock.fork_as_promise (fun () -> 111 - (* If it's been more than half a second, show the state as loading*) 111 + (* If it's been more than half a second, show the state as loading*) 112 112 Control.sleep ~seconds:0.3; 113 113 viewState $= { (Lwd.peek viewState) with detail = Loading }); 114 114 current_detail_computation ··· 116 116 try 117 117 [%log debug "Rendering status detail with: %a" pp_status_state msg]; 118 118 let detail = Loaded (render_detail msg) in 119 - (*Make sure the loading is done*) 119 + (*Make sure the loading is done*) 120 120 !current_loading_computation |> Promise.terminate; 121 121 viewState $= { (Lwd.peek viewState) with detail } 122 122 with
+4
jj_tui/lib/key_map.ml
··· 143 143 type t = { 144 144 confirm:key; 145 145 decline:key; 146 + left_alt:key; 147 + right_alt:key; 146 148 graph : graph_keys; [@updater] 147 149 file : file_keys;[@updater] 148 150 }[@@deriving yaml, record_updater ~derive: yaml] ··· 154 156 let default:t = { 155 157 confirm= simple_key 'y'; 156 158 decline= simple_key 'n'; 159 + left_alt= simple_key 'h'; 160 + right_alt= simple_key 'l'; 157 161 graph = { 158 162 show_help = simple_key '?'; 159 163 prev = simple_key 'P';
+8
todo.md
··· 1 + ## Key remapping: 2 + 3 + How to hande key remapping: 4 + - Inside nottui: 5 + - I coud allow users to specify some kind of key mapping function that looks for incoming keys and maps them to other keys. 6 + - Inside my own program. 7 + - I could make all components take an `keyList` record and let the caller override that. 8 + - This option is more versitile because it allows one list to use say, arrows, and the other to use something like hjkl