diff options
| author | Julian Prein <julian@druckdev.xyz> | 2024-11-12 17:36:12 +0100 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2024-12-12 13:53:08 +0900 |
| commit | 66dbee10f56ba3d776ad176b603eee9f30f0e940 (patch) | |
| tree | 22b77de908c26927b2194e5fb09dc52653e8a844 /src | |
| parent | 19e9b620ba222b8f56d0d68194809066772b85fe (diff) | |
| download | fzf-66dbee10f56ba3d776ad176b603eee9f30f0e940.tar.gz | |
Fix minimum preview width without left/right borders
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/terminal.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/terminal.go b/src/terminal.go index 467682a9..23e9767f 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -1679,7 +1679,13 @@ func (t *Terminal) resizeWindows(forcePreview bool) { createPreviewWindow(marginInt[0]+height-pheight, marginInt[3], width, pheight) } case posLeft, posRight: - pwidth := calculateSize(width, previewOpts.size, minWidth, 5, 4) + pad := borderColumns(previewOpts.border, t.borderWidth) + if len(t.scrollbar) > 0 && !previewOpts.border.HasRight() { + // Need a column to show scrollbar + pad += 1 + } + minPreviewWidth := 1 + pad + pwidth := calculateSize(width, previewOpts.size, minWidth, minPreviewWidth, pad) if hasThreshold && pwidth < previewOpts.threshold { t.activePreviewOpts = previewOpts.alternative if forcePreview { @@ -1718,9 +1724,6 @@ func (t *Terminal) resizeWindows(forcePreview bool) { marginInt[0], marginInt[3], width-pwidth, height, false, noBorder) // NOTE: fzf --preview 'cat {}' --preview-window border-left --border x := marginInt[3] + width - pwidth - if !previewOpts.border.HasRight() && t.borderShape.HasRight() { - pwidth++ - } createPreviewWindow(marginInt[0], x, pwidth, height) } } |
