mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-12-22 19:09:00 +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
|
return screenWidth, screenHeight, marginInt, paddingInt
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Terminal) resizeWindows(forcePreview bool) {
|
func (t *Terminal) resizeWindows(forcePreview bool, redrawBorder bool) {
|
||||||
t.forcePreview = forcePreview
|
t.forcePreview = forcePreview
|
||||||
screenWidth, screenHeight, marginInt, paddingInt := t.adjustMarginAndPadding()
|
screenWidth, screenHeight, marginInt, paddingInt := t.adjustMarginAndPadding()
|
||||||
width := screenWidth - marginInt[1] - marginInt[3]
|
width := screenWidth - marginInt[1] - marginInt[3]
|
||||||
height := screenHeight - marginInt[0] - marginInt[2]
|
height := screenHeight - marginInt[0] - marginInt[2]
|
||||||
|
|
||||||
t.prevLines = make([]itemLine, screenHeight)
|
t.prevLines = make([]itemLine, screenHeight)
|
||||||
if t.border != nil {
|
if t.border != nil && redrawBorder {
|
||||||
t.border.Close()
|
t.border.Close()
|
||||||
|
t.border = nil
|
||||||
}
|
}
|
||||||
if t.window != nil {
|
if t.window != nil {
|
||||||
t.window.Close()
|
t.window.Close()
|
||||||
@ -1573,7 +1574,7 @@ func (t *Terminal) resizeWindows(forcePreview bool) {
|
|||||||
offsets[1] -= 1 + bw
|
offsets[1] -= 1 + bw
|
||||||
offsets[2] += 1 + bw
|
offsets[2] += 1 + bw
|
||||||
}
|
}
|
||||||
if t.borderShape != tui.BorderNone {
|
if t.border == nil && t.borderShape != tui.BorderNone {
|
||||||
t.border = t.tui.NewWindow(
|
t.border = t.tui.NewWindow(
|
||||||
marginInt[0]+offsets[0], marginInt[3]+offsets[1], width+offsets[2], height+offsets[3],
|
marginInt[0]+offsets[0], marginInt[3]+offsets[1], width+offsets[2], height+offsets[3],
|
||||||
false, tui.MakeBorderStyle(t.borderShape, t.unicode))
|
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() {
|
func (t *Terminal) printAll() {
|
||||||
t.resizeWindows(t.forcePreview)
|
t.resizeWindows(t.forcePreview, true)
|
||||||
t.printList()
|
t.printList()
|
||||||
t.printPrompt()
|
t.printPrompt()
|
||||||
t.printInfo()
|
t.printInfo()
|
||||||
@ -3561,7 +3562,7 @@ func (t *Terminal) Loop() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
t.termSize = t.tui.Size()
|
t.termSize = t.tui.Size()
|
||||||
t.resizeWindows(false)
|
t.resizeWindows(false, false)
|
||||||
t.window.Erase()
|
t.window.Erase()
|
||||||
t.mutex.Unlock()
|
t.mutex.Unlock()
|
||||||
|
|
||||||
@ -4037,7 +4038,7 @@ func (t *Terminal) Loop() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
updatePreviewWindow := func(forcePreview bool) {
|
updatePreviewWindow := func(forcePreview bool) {
|
||||||
t.resizeWindows(forcePreview)
|
t.resizeWindows(forcePreview, false)
|
||||||
req(reqPrompt, reqList, reqInfo, reqHeader)
|
req(reqPrompt, reqList, reqInfo, reqHeader)
|
||||||
}
|
}
|
||||||
toggle := func() bool {
|
toggle := func() bool {
|
||||||
|
@ -412,7 +412,7 @@ type BorderCharacter int
|
|||||||
func MakeBorderStyle(shape BorderShape, unicode bool) BorderStyle {
|
func MakeBorderStyle(shape BorderShape, unicode bool) BorderStyle {
|
||||||
if shape == BorderNone {
|
if shape == BorderNone {
|
||||||
return BorderStyle{
|
return BorderStyle{
|
||||||
shape: BorderRounded,
|
shape: shape,
|
||||||
top: ' ',
|
top: ' ',
|
||||||
bottom: ' ',
|
bottom: ' ',
|
||||||
left: ' ',
|
left: ' ',
|
||||||
|
Loading…
Reference in New Issue
Block a user