summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2020-11-03 21:49:21 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2020-11-03 22:04:01 +0900
commit2553806e79bc05a098d12b9e57281512e38d382e (patch)
treed7c10aa89a6e3275936c3e4dde2911ebda7fb0b5
parent1bcbc5a353c76c791032657a160fa08fe5090fb6 (diff)
Allow preview window height shorter than 3
Fix #2231
-rw-r--r--src/terminal.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/terminal.go b/src/terminal.go
index cc372c50..3c6960a4 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -653,7 +653,7 @@ func (t *Terminal) displayWidth(runes []rune) int {
}
const (
- minWidth = 16
+ minWidth = 4
minHeight = 4
maxDisplayWidthCalc = 1024
@@ -801,17 +801,19 @@ func (t *Terminal) resizeWindows() {
t.pwindow = t.tui.NewWindow(y, x, pwidth, pheight, true, noBorder)
}
verticalPad := 2
+ minPreviewHeight := 3
if t.preview.border == tui.BorderNone {
verticalPad = 0
+ minPreviewHeight = 1
}
switch t.preview.position {
case posUp:
- pheight := calculateSize(height, t.preview.size, minHeight, 3, verticalPad)
+ pheight := calculateSize(height, t.preview.size, minHeight, minPreviewHeight, verticalPad)
t.window = t.tui.NewWindow(
marginInt[0]+pheight, marginInt[3], width, height-pheight, false, noBorder)
createPreviewWindow(marginInt[0], marginInt[3], width, pheight)
case posDown:
- pheight := calculateSize(height, t.preview.size, minHeight, 3, verticalPad)
+ pheight := calculateSize(height, t.preview.size, minHeight, minPreviewHeight, verticalPad)
t.window = t.tui.NewWindow(
marginInt[0], marginInt[3], width, height-pheight, false, noBorder)
createPreviewWindow(marginInt[0]+height-pheight, marginInt[3], width, pheight)