feat: resize side/diff panel width#18
Conversation
|
I can't reproduce this with any of my terminals (Zed, Wezterm). |
e2ed558 to
a2a72b0
Compare
- Alt+h/l: shrink/expand side panel by 5% steps - Alt+H: jump main (diff) panel to full width - Alt+L: jump side panel to full width - Alt+r: reset side panel to configured default width - Panel can now reach both borders (0%–100%) - Side panel fully collapsed hides side panels entirely - Side panel fully expanded hides diff panel entirely (no border artifact) - Fix parse_key: <a-X> with uppercase X now includes SHIFT modifier - Fix parse_key: <c-s-X> Ctrl+Shift combo parsed before <c-X>
a2a72b0 to
f6ce727
Compare
|
@Blankeos Sorry about that, can you check now? I have made some improvements and I tested on kitty and zed. However, I could'n test on Wezterm yet. |
|
Hi @Blankeos! Have you check the last change i made into this PR? Let me know what you think :) |
|
Hi sorry! Had to go offline a lot this week. Btw by chance... Have you not tried to do the But I'll still merge this since...
I'm merging it, but I'll go ahead and fix these bugs Codex found, before I release: I found regressions on feature/expand-shrink compared to origin/main.
Findings
# I think this one needs fixing
1. High: side-panel-full can crash or render the command log off-
screen.
When side_panel_ratio reaches 1.0, layout returns main_panel:
Rect::default() in src/gui/layout.rs:218. Rendering skips the
main panel, but render_command_log still computes placement
from fl.main_panel.height in src/gui/views.rs:718. With the
default command log enabled and non-empty, 0 - log_height - 1
underflows in debug builds and wraps in release builds.
# I dont think this needs fixing. Probably just an accepted limitation.
2. Medium: making the side panel full does not update focus.
The new Alt full-panel handlers only mutate side_panel_ratio in
src/gui/mod.rs:1527. If the diff was focused and the user
expands the side panel to full width, the diff disappears but
diff_focused remains true. Subsequent keys and mouse wheel
events still route to hidden diff behavior, including the
scroll path at src/gui/mod.rs:4483. The visible sidebar is not
naturally controllable until the user explicitly changes focus. |
Summary
Adds orientation-aware side-panel resize keybindings. At both ratio extremes the hidden panel is fully removed from the layout — no leftover border or empty rect.
ezgif-3c1d783226675521.mp4
Landscape (side left, diff right)
Alt+HAlt+LAlt+KAlt+JAlt+RPortrait / vertical stack (side top, diff bottom)
Alt+HAlt+LAlt+KAlt+JAlt+RImplementation
keybindings.rs— addedshrinkSidePanel(<a-h>),expandSidePanel(<a-l>),sidePanelFull(<a-k>),mainPanelFull(<a-j>),resetSidePanel(<a-r>) toUniversalKeybinding; all user-overridable via configlayout.rs— portrait branch gets symmetric early-returns at ratio ≤ 0.0 and ≥ 1.0 (mirrors existing landscape short-circuits); removedheight/2cap so stepping is unrestricted; portrait collapsed-panel height fixed to1to prevent the active-panel height jumping backwards when crossing the 21-row threshold; landscape panel sizing extracted intosplit_side_panels()mod.rs— resize handler detects portrait mode at dispatch time and swapsAlt+K/Alt+Jsemantics accordingly; step behaviour is identical in both orientationsviews.rs— guards main panel rendering behindfl.main_panel.width > 0so it is skipped when the side panel is fully expandedTested
Kitty, Zed