summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2024-12-14 21:50:36 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2024-12-14 22:06:14 +0900
commitcdcab267660473de1621b4a1d8c8f2d4d43f05ae (patch)
treebc8d1ad56b0f07ed5040f1c24bb0956cf0d14b60 /src
parentec3acb19321b8f74035225baf4a188cbb1163909 (diff)
downloadfzf-cdcab267660473de1621b4a1d8c8f2d4d43f05ae.tar.gz
Fix redundant clearing of the windows with non-default bg color
Diffstat (limited to 'src')
-rw-r--r--src/terminal.go13
-rw-r--r--src/tui/tui.go2
2 files changed, 8 insertions, 7 deletions
diff --git a/src/terminal.go b/src/terminal.go
index 1b3efdec..7ea61744 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -1531,15 +1531,16 @@ func (t *Terminal) adjustMarginAndPadding() (int, int, [4]int, [4]int) {
return screenWidth, screenHeight, marginInt, paddingInt
}
-func (t *Terminal) resizeWindows(forcePreview bool) {
+func (t *Terminal) resizeWindows(forcePreview bool, redrawBorder bool) {
t.forcePreview = forcePreview
screenWidth, screenHeight, marginInt, paddingInt := t.adjustMarginAndPadding()
width := screenWidth - marginInt[1] - marginInt[3]
height := screenHeight - marginInt[0] - marginInt[2]
t.prevLines = make([]itemLine, screenHeight)
- if t.border != nil {
+ if t.border != nil && redrawBorder {
t.border.Close()
+ t.border = nil
}
if t.window != nil {
t.window.Close()
@@ -1573,7 +1574,7 @@ func (t *Terminal) resizeWindows(forcePreview bool) {
offsets[1] -= 1 + bw
offsets[2] += 1 + bw
}
- if t.borderShape != tui.BorderNone {
+ if t.border == nil && t.borderShape != tui.BorderNone {
t.border = t.tui.NewWindow(
marginInt[0]+offsets[0], marginInt[3]+offsets[1], width+offsets[2], height+offsets[3],
false, tui.MakeBorderStyle(t.borderShape, t.unicode))
@@ -2935,7 +2936,7 @@ func (t *Terminal) processTabs(runes []rune, prefixWidth int) (string, int) {
}
func (t *Terminal) printAll() {
- t.resizeWindows(t.forcePreview)
+ t.resizeWindows(t.forcePreview, true)
t.printList()
t.printPrompt()
t.printInfo()
@@ -3561,7 +3562,7 @@ func (t *Terminal) Loop() error {
return err
}
t.termSize = t.tui.Size()
- t.resizeWindows(false)
+ t.resizeWindows(false, false)
t.window.Erase()
t.mutex.Unlock()
@@ -4037,7 +4038,7 @@ func (t *Terminal) Loop() error {
}
}
updatePreviewWindow := func(forcePreview bool) {
- t.resizeWindows(forcePreview)
+ t.resizeWindows(forcePreview, false)
req(reqPrompt, reqList, reqInfo, reqHeader)
}
toggle := func() bool {
diff --git a/src/tui/tui.go b/src/tui/tui.go
index 04d548f4..c5330849 100644
--- a/src/tui/tui.go
+++ b/src/tui/tui.go
@@ -412,7 +412,7 @@ type BorderCharacter int
func MakeBorderStyle(shape BorderShape, unicode bool) BorderStyle {
if shape == BorderNone {
return BorderStyle{
- shape: BorderRounded,
+ shape: shape,
top: ' ',
bottom: ' ',
left: ' ',