Skip to content

Commit 316c37c

Browse files
committed
Fix scrollbar sizes for diff mode
Scrollbars were not properly sized since folds were not retained in the window workspace used for sizing calculations. The problem was most noticeable with many lines and few differences.
1 parent 8cc50e5 commit 316c37c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lua/scrollview.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,11 @@ local with_win_workspace = function(winid, fun)
547547
-- Don't include the workspace window in a diff session. If included,
548548
-- closing it could end the diff session (e.g., when there is one other
549549
-- window in the session). Issue #57.
550-
set_window_option(workspace_winid, 'diff', false)
550+
if api.nvim_win_get_option(0, 'foldmethod') == 'diff' then
551+
-- First set foldmethod to manual so that folds are retained.
552+
set_window_option(workspace_winid, 'foldmethod', 'manual')
553+
set_window_option(workspace_winid, 'diff', false)
554+
end
551555
end
552556
end
553557
local success, result = pcall(function()

0 commit comments

Comments
 (0)