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 single pane mode

+40 -12
+2
README.md
··· 42 42 sub: 43 43 # sub menu command 44 44 s: "squash_into_parent" 45 + # If the terminal is smaller than this width, the UI will change to a single pane view 46 + single_pane_width_threshold: 110 45 47 ``` 46 48 For a full list of commands ids see [`jj_tui/bin/graph_commands.ml`](jj_tui/bin/graph_commands.ml) and [`jj_tui/bin/file_commands.ml`](jj_tui/bin/file_commands.ml) 47 49
+35 -10
jj_tui/bin/jj_ui.ml
··· 59 59 `Handled 60 60 (* | `Arrow _, [ `Ctrl ] *) 61 61 (* | `Arrow _, [ `Meta ] *) 62 - | `Tab,[]->`Handled 63 - | `Tab, [ `Meta ] 64 - | `Tab, [ `Meta; `Shift ] -> 65 - `Handled 62 + | `Tab, [] -> 63 + `Handled 64 + | `Tab, [ `Meta ] | `Tab, [ `Meta; `Shift ] -> 65 + `Handled 66 66 | _ -> 67 67 `Unhandled) 68 68 ; (fun event -> ··· 111 111 |> inputs 112 112 ;; 113 113 114 + (** Makes a UI element responsive to terminal width and focus state 115 + - When focused: shows at full width if terminal is wide enough, or fills terminal if narrow 116 + - When unfocused: shows at normal width if terminal is wide enough, or collapses if narrow *) 117 + let responsive_view ?(shrunk_width=0) ?(shrink_on= `Focus) ui = 118 + let$* w, h = Lwd.get Vars.term_width_height in 119 + let$ ui = ui in 120 + 121 + let should_shrink = match shrink_on with 122 + | `Focus -> Ui.has_focus ui 123 + | `Unfocus -> not (Ui.has_focus ui) 124 + in 125 + let threhold=(Lwd.peek Vars.config).single_pane_width_threshold in 126 + if should_shrink 127 + then if w < threhold 128 + then ui |> Ui.resize ~w:w ~mw:w 129 + else ui 130 + else if w < threhold 131 + then ui |> Ui.resize ~w:shrunk_width ~mw:shrunk_width 132 + else ui 133 + ;; 134 + 114 135 (** The primary view for the UI with the file_view graph_view and summary*) 115 136 let main_view () = 116 137 let file_focus = Focus.make () in ··· 153 174 ~mw:1000) 154 175 |> W.Box.focusable ~focus:branch_focus ~pad_h:0 ~pad_w:1 155 176 ] 177 + |> responsive_view ~shrunk_width:0 156 178 ; (*Right side summary/status/fileinfo view*) 157 - Show_view.render summary_focus 158 - |> W.Scroll.area 159 - (* let mw=Int.max (Ui.layout_max_width ui) 100 in *) 160 - |>$ Ui.resize ~w:0 ~sh:3 ~sw:1 ~mw:10000 ~mh:10000 161 - |> W.on_focus ~focus:summary_focus (Ui.resize ~sw:3 ~mw:1000) 162 - |> W.Box.focusable ~focus:summary_focus ~pad_h:0 ~pad_w:1 179 + (let ui = 180 + Show_view.render summary_focus 181 + |> W.Scroll.area 182 + (* let mw=Int.max (Ui.layout_max_width ui) 100 in *) 183 + |>$ Ui.resize ~w:3 ~sh:3 ~sw:1 ~mw:10000 ~mh:10000 184 + |> W.on_focus ~focus:summary_focus (Ui.resize ~sw:3 ~mw:1000) 185 + |> W.Box.focusable ~focus:summary_focus ~pad_h:0 ~pad_w:1 186 + in 187 + responsive_view ~shrunk_width:0 ui) 163 188 ] 164 189 (*These outer prompts can popup and show them selves over the main view*) 165 190 |> W.Overlay.text_prompt ~char_count:true ~show_prompt_var:ui_state.show_prompt
+3 -2
jj_tui/lib/config.ml
··· 2 2 open Logging 3 3 4 4 5 - type t = { key_map : Key_map.key_config[@updater] } [@@deriving yaml, record_updater ~derive: yaml] 5 + type t = { key_map : Key_map.key_config[@updater]; single_pane_width_threshold:int } [@@deriving yaml, record_updater ~derive: yaml] 6 6 7 7 8 8 let default_config:t = 9 9 { 10 - key_map= Key_map.default 10 + key_map= Key_map.default; 11 + single_pane_width_threshold=100; 11 12 } 12 13 ;; 13 14