mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-12-22 10:58:59 +00:00
Fix redundant clearing of the windows with non-default bg color
This commit is contained in:
parent
ec3acb1932
commit
cdcab26766
@ -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 {
|
||||
|
@ -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: ' ',
|
||||
|
Loading…
Reference in New Issue
Block a user