Skip to content

feat: support mouse dragging panel separators to resize panelsadded drag column function#3890

Open
winlaic wants to merge 2 commits intosxyazi:mainfrom
winlaic:main
Open

feat: support mouse dragging panel separators to resize panelsadded drag column function#3890
winlaic wants to merge 2 commits intosxyazi:mainfrom
winlaic:main

Conversation

@winlaic
Copy link
Copy Markdown

@winlaic winlaic commented Apr 15, 2026

Implements tmux-style mouse dragging of the panel separators to dynamically resize the parent, current, and preview panels (see the gif below).

example

Changes

yazi-config/preset/yazi-default.toml

  • Added "drag" to the default mouse_events list so drag handling is enabled by default.

yazi-actor/src/app/mouse.rs

  • Added render!() after the Root:drag() Lua call so the UI repaints immediately on every drag event.
  • Without this, dragging updated the layout state but the resize was not visible until some unrelated event triggered a redraw.

yazi-plugin/preset/components/root.lua

  • Added a _drag_which field (nil | "left" | "right") to track which separator is currently being dragged.
  • Extended Root:click() to detect mouse-down on either separator (with a ±1 column tolerance), set _drag_which, and clear it again on mouse-up.
  • Implemented Root:drag() to read the current panel widths from tab._chunks, compute the new widths from the cursor position, and write the updated all-pixel-width array back to rt.mgr.ratio.

How it works

mouse down near separator  ->  Root:click()  sets _drag_which
mouse drag                 ->  Root:drag()   updates rt.mgr.ratio + render!()
mouse up                   ->  Root:click()  clears _drag_which

The separator hit zones are derived from tab._chunks, which contains the three column rects produced by Tab:layout()
Each separator uses a ±1 column tolerance and is only active when the corresponding side panel is visible (width > 0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant