Skip to content
Myr

Fix minimum preview width without left/right borders

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

When the chosen preview border shape has no left and/or right border, the minimum total preview window size decreases. But due to the hardcoded value for the minimum size of the preview window the size could not be decreased further than 5.

authored by Julian Prein · committed by Junegunn Choi · parent 19e9b62 · Browse files · 1 file+7 added−4 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+7 added−4 removed

  • other:+7 added−4 removed

1 file+7 added−4 removed

modified:src/terminal.go+7 added-4 removed
1677 unmodified lines
1678 marginInt[0], marginInt[3], width, height-pheight, false, noBorder)1679 createPreviewWindow(marginInt[0]+height-pheight, marginInt[3], width, pheight)1680 }1681 case posLeft, posRight:1682 pad := borderColumns(previewOpts.border, t.borderWidth)1683 if len(t.scrollbar) > 0 && !previewOpts.border.HasRight() {1684 // Need a column to show scrollbar1685 pad += 11686 }1687 minPreviewWidth := 1 + pad1682 pwidth := calculateSize(width, previewOpts.size, minWidth, 5, 4)1688 pwidth := calculateSize(width, previewOpts.size, minWidth, minPreviewWidth, pad)1689 if hasThreshold && pwidth < previewOpts.threshold {1690 t.activePreviewOpts = previewOpts.alternative1691 if forcePreview {1692 previewOpts.alternative.hidden = false
30 unmodified lines
1723 t.window = t.tui.NewWindow(1724 marginInt[0], marginInt[3], width-pwidth, height, false, noBorder)1725 // NOTE: fzf --preview 'cat {}' --preview-window border-left --border1726 x := marginInt[3] + width - pwidth1721 if !previewOpts.border.HasRight() && t.borderShape.HasRight() {1722 pwidth++1723 }1727 createPreviewWindow(marginInt[0], x, pwidth, height)1728 }1729 }1730 }
3569 unmodified lines