wezterm icon indicating copy to clipboard operation
wezterm copied to clipboard

Per pane scroll bar

Open davidrios opened this issue 3 years ago • 1 comments

Implement per-pane scroll bar

  • Now instead of a boolean "enable_scroll_bar" config, you can control if you want to enable scroll bars on all panes (AllPanes), just the active one (ActivePane) or None at all with the config "scroll_bar_mode"
  • Scroll bar width adjusted to ~1/4 of a cell, or it would not fit in split panes
  • Adjusted horizontal panel split mouse dragging area size, so it's possible to also drag a scroll bar beside it
  • Right window padding has an enforced minimum size of 1/4 of a cell when scrollbars are enabled

Dev notes:

  • Mouse events for the scroll bar have a pane_id member, so they correctly trigger for their respective panes
  • ScrollHit changed to instantiable ScrollThumb, encapsulating more information about the scroll bar, so the loginc doesn't need to be duplicated again in the mouse event handler
  • Fixed a bug where split panes would not fill the screen all the way if it wasn't aligned to the cell size

davidrios avatar Apr 17 '22 22:04 davidrios

Thanks for this! I finally had some time to look over this and try it out!

Let's talk about the scrollbar width :-)

image

Having the width set to a fraction of a cell makes it almost impossible to click and drag with the default settings on macOS (pictured above).

When running in AllPanes mode, the width of the scrollbar is no longer controlled by window_padding (see the third paragraph on that page!). I think we should be OK to keep the original width for this case, as the splits aren't getting in the way.

For the ActivePane case... what do you think about rendering it wider when hovering over the thumb? I think the scrollbar could always be the original padding related width when it is aligned to the RHS of the window. For other cases, on hover, it could render full width over the split. The hover hit box should probably be to the left of the split divider, but perhaps it could reasonably extend a ~full cell to the left, so that it covers the left half of the cell holding the split line, and the right ~half of the cell to its left.

  • Bug: changing the font scaling (CMD +) doesn't recompute the scroll bar positioning!
  • Bug: reloading the config (CMD-SHIFT-R) should cause the scroll bar to recompute (eg: CMD-+ first to produce an artifact; reloading the config should cause it to clear)

wez avatar Apr 25 '22 01:04 wez