···4242 sub:
4343 # sub menu command
4444 s: "squash_into_parent"
4545+# If the terminal is smaller than this width, the UI will change to a single pane view
4646+single_pane_width_threshold: 110
4547```
4648For 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)
4749
+35-10
jj_tui/bin/jj_ui.ml
···5959 `Handled
6060 (* | `Arrow _, [ `Ctrl ] *)
6161 (* | `Arrow _, [ `Meta ] *)
6262- | `Tab,[]->`Handled
6363- | `Tab, [ `Meta ]
6464- | `Tab, [ `Meta; `Shift ] ->
6565- `Handled
6262+ | `Tab, [] ->
6363+ `Handled
6464+ | `Tab, [ `Meta ] | `Tab, [ `Meta; `Shift ] ->
6565+ `Handled
6666 | _ ->
6767 `Unhandled)
6868 ; (fun event ->
···111111 |> inputs
112112 ;;
113113114114+ (** Makes a UI element responsive to terminal width and focus state
115115+ - When focused: shows at full width if terminal is wide enough, or fills terminal if narrow
116116+ - When unfocused: shows at normal width if terminal is wide enough, or collapses if narrow *)
117117+ let responsive_view ?(shrunk_width=0) ?(shrink_on= `Focus) ui =
118118+ let$* w, h = Lwd.get Vars.term_width_height in
119119+ let$ ui = ui in
120120+121121+ let should_shrink = match shrink_on with
122122+ | `Focus -> Ui.has_focus ui
123123+ | `Unfocus -> not (Ui.has_focus ui)
124124+ in
125125+ let threhold=(Lwd.peek Vars.config).single_pane_width_threshold in
126126+ if should_shrink
127127+ then if w < threhold
128128+ then ui |> Ui.resize ~w:w ~mw:w
129129+ else ui
130130+ else if w < threhold
131131+ then ui |> Ui.resize ~w:shrunk_width ~mw:shrunk_width
132132+ else ui
133133+ ;;
134134+114135 (** The primary view for the UI with the file_view graph_view and summary*)
115136 let main_view () =
116137 let file_focus = Focus.make () in
···153174 ~mw:1000)
154175 |> W.Box.focusable ~focus:branch_focus ~pad_h:0 ~pad_w:1
155176 ]
177177+ |> responsive_view ~shrunk_width:0
156178 ; (*Right side summary/status/fileinfo view*)
157157- Show_view.render summary_focus
158158- |> W.Scroll.area
159159- (* let mw=Int.max (Ui.layout_max_width ui) 100 in *)
160160- |>$ Ui.resize ~w:0 ~sh:3 ~sw:1 ~mw:10000 ~mh:10000
161161- |> W.on_focus ~focus:summary_focus (Ui.resize ~sw:3 ~mw:1000)
162162- |> W.Box.focusable ~focus:summary_focus ~pad_h:0 ~pad_w:1
179179+ (let ui =
180180+ Show_view.render summary_focus
181181+ |> W.Scroll.area
182182+ (* let mw=Int.max (Ui.layout_max_width ui) 100 in *)
183183+ |>$ Ui.resize ~w:3 ~sh:3 ~sw:1 ~mw:10000 ~mh:10000
184184+ |> W.on_focus ~focus:summary_focus (Ui.resize ~sw:3 ~mw:1000)
185185+ |> W.Box.focusable ~focus:summary_focus ~pad_h:0 ~pad_w:1
186186+ in
187187+ responsive_view ~shrunk_width:0 ui)
163188 ]
164189 (*These outer prompts can popup and show them selves over the main view*)
165190 |> W.Overlay.text_prompt ~char_count:true ~show_prompt_var:ui_state.show_prompt