Skip to content
Myr

Fix window sizing with borders on the right

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Junegunn Choi · committed by Junegunn Choi · parent 43eafdf · Browse files · 1 file+15 added−11 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+15 added−11 removed

  • other:+15 added−11 removed

1 file+15 added−11 removed

modified:src/terminal.go+15 added-11 removed
1754 unmodified lines
17551756 t.areaLines = height1757 t.areaColumns = width17581759 // If none of the inner borders has the right side, but the outer border does, increase the list width by 1 column1760 listStickToRight := t.borderShape.HasRight() && !t.listBorderShape.HasRight() && !t.inputBorderShape.HasRight() &&1761 (!t.headerVisible || !t.headerBorderShape.HasRight() || t.visibleHeaderLines() == 0)17621763 // Set up preview window1764 noBorder := tui.MakeBorderStyle(tui.BorderNone, t.unicode)1765 if forcePreview || t.needPreviewWindow() {1766 var resizePreviewWindows func(previewOpts *previewOpts)1763 stickToRight := false1767 resizePreviewWindows = func(previewOpts *previewOpts) {1768 t.activePreviewOpts = previewOpts1769 if previewOpts.size.size == 0 {1770 return
57 unmodified lines
1828 }1829 if previewOpts.hidden {1830 return1831 }1829 // If none of the inner borders has the right side, but the outer border does, increase the width by 1 column1830 stickToRight = t.borderShape.HasRight() &&1831 !previewOpts.HasBorderRight() && !t.listBorderShape.HasRight() && !t.inputBorderShape.HasRight() &&1832 (!t.headerVisible || !t.headerBorderShape.HasRight() || t.visibleHeaderLines() == 0)1833 if stickToRight {18321833 listStickToRight = listStickToRight && !previewOpts.HasBorderRight()1834 if listStickToRight {1835 innerWidth++1836 width++1837 }1838
64 unmodified lines
19031904 innerBorderFn(marginInt[0], marginInt[3]+pwidth, width-pwidth, height)1905 createPreviewWindow(marginInt[0], marginInt[3], pwidth, height)1906 } else {1906 // NOTE: fzf --preview 'cat {}' --preview-window border-left --border1907 stickToRight = !previewOpts.HasBorderRight() && t.borderShape.HasRight()1908 if stickToRight {1907 // NOTE: Relaxed condition for the following cases1908 // fzf --preview 'seq 500' --preview-window border-left --border1909 // fzf --preview 'seq 500' --preview-window border-left --border --list-border1910 // fzf --preview 'seq 500' --preview-window border-left --border --input-border1911 listStickToRight = t.borderShape.HasRight() && !previewOpts.HasBorderRight()1912 if listStickToRight {1913 innerWidth++1914 width++1915 }1916 innerBorderFn(marginInt[0], marginInt[3], width-pwidth, height)
5 unmodified lines
1922 }1923 }1924 resizePreviewWindows(&t.previewOpts)19251922 if t.borderShape.HasRight() && !stickToRight {1926 if t.borderShape.HasRight() && !listStickToRight {1927 // Need to clear the extra margin between the borders1928 // fzf --preview 'seq 1000' --preview-window border-left --bind space:change-preview-window:border-rounded --border vertical1929 // fzf --preview 'seq 1000' --preview-window up,hidden --bind space:toggle-preview --border vertical1930 y := 0
14 unmodified lines
1945 }19461947 // Without preview window1948 if t.window == nil {1945 if t.borderShape.HasRight() && !hasListBorder {1949 if listStickToRight {1950 // Put scrollbar closer to the right border for consistent look1951 innerWidth++1952 width++1953 }
3814 unmodified lines