Skip to content
Myr

Fix panic when trying to render preview window of a negative height

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

Fix #3292

authored by Junegunn Choi · committed by Junegunn Choi · parent 17a13f0 · Browse files · 1 file+3 added−1 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+3 added−1 removed

  • other:+3 added−1 removed

1 file+3 added−1 removed

modified:src/terminal.go+3 added-1 removed
1233 unmodified lines
1234 if len(t.scrollbar) > 0 && !previewOpts.border.HasRight() {1235 // Need a column to show scrollbar1236 pwidth -= 11237 }1238 pwidth = util.Max(0, pwidth)1239 pheight = util.Max(0, pheight)1240 t.pwindow = t.tui.NewWindow(y, x, pwidth, pheight, true, noBorder)1241 }1242 verticalPad := 21243 minPreviewHeight := 3
730 unmodified lines
1974 }1975}19761977func (t *Terminal) printPreview() {1976 if !t.hasPreviewWindow() {1978 if !t.hasPreviewWindow() || t.pwindow.Height() == 0 {1979 return1980 }1981 numLines := len(t.previewer.lines)1982 height := t.pwindow.Height()
1729 unmodified lines