Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

treeview: add horizontal scrolling #1717

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
treeview: shrink the scrollable width to current scroll position
Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
  • Loading branch information
takase1121 and Guldoman authored Feb 6, 2024
commit a68a45621fce1454cec42bbd9a4332cd6eebe266
8 changes: 7 additions & 1 deletion data/plugins/treeview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,14 @@ function TreeView:draw()
sw = math.max(w, sw)
end
end
if sw > self.scroll.x + self.size.x then
local ss = self:get_h_scrollable_size()
if sw > self.scroll_width then
-- We can increase the scrollable size without issues
self.scroll_width = sw
elseif ss > self.scroll.x + self.size.x then
-- We can decrease it only up to the current scroll position
local so = ss - self.scroll_width -- Keep track of the vertical scrollbar offset
self.scroll_width = math.max(sw + so, self.scroll.x + self.size.x) - so
end

self:draw_scrollbar()
Expand Down
Loading