Skip to content
Myr

Fix redundant clearing of the windows with non-default bg color

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

authored by Junegunn Choi · committed by Junegunn Choi · parent ec3acb1 · Browse files · 2 files+8 added−7 removed
This commit

State

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

Diff stats

2 files+8 added−7 removed

  • other:+8 added−7 removed

2 files+8 added−7 removed

modified:src/tui/tui.go+1 added-1 removed
410 unmodified lines
411412func MakeBorderStyle(shape BorderShape, unicode bool) BorderStyle {413 if shape == BorderNone {414 return BorderStyle{415 shape: BorderRounded,415 shape: shape,416 top: ' ',417 bottom: ' ',418 left: ' ',419 right: ' ',
467 unmodified lines
modified:src/terminal.go+7 added-6 removed
1529 unmodified lines
15301531 return screenWidth, screenHeight, marginInt, paddingInt1532}15331534func (t *Terminal) resizeWindows(forcePreview bool) {1534func (t *Terminal) resizeWindows(forcePreview bool, redrawBorder bool) {1535 t.forcePreview = forcePreview1536 screenWidth, screenHeight, marginInt, paddingInt := t.adjustMarginAndPadding()1537 width := screenWidth - marginInt[1] - marginInt[3]1538 height := screenHeight - marginInt[0] - marginInt[2]15391540 t.prevLines = make([]itemLine, screenHeight)1541 if t.border != nil {1541 if t.border != nil && redrawBorder {1542 t.border.Close()1543 t.border = nil1544 }1545 if t.window != nil {1546 t.window.Close()1547 t.window = nil
25 unmodified lines
1573 if t.borderShape.HasLeft() {1574 offsets[1] -= 1 + bw1575 offsets[2] += 1 + bw1576 }1576 if t.borderShape != tui.BorderNone {1577 if t.border == nil && t.borderShape != tui.BorderNone {1578 t.border = t.tui.NewWindow(1579 marginInt[0]+offsets[0], marginInt[3]+offsets[1], width+offsets[2], height+offsets[3],1580 false, tui.MakeBorderStyle(t.borderShape, t.unicode))1581 }
1353 unmodified lines
2935 return strbuf.String(), l2936}29372938func (t *Terminal) printAll() {2938 t.resizeWindows(t.forcePreview)2939 t.resizeWindows(t.forcePreview, true)2940 t.printList()2941 t.printPrompt()2942 t.printInfo()2943 t.printHeader()
617 unmodified lines
3561 t.eventBox.Set(EvtQuit, quitSignal{ExitError, err})3562 return err3563 }3564 t.termSize = t.tui.Size()3564 t.resizeWindows(false)3565 t.resizeWindows(false, false)3566 t.window.Erase()3567 t.mutex.Unlock()35683569 t.reqBox.Set(reqPrompt, nil)
467 unmodified lines
4037 }4038 }4039 }4040 updatePreviewWindow := func(forcePreview bool) {4040 t.resizeWindows(forcePreview)4041 t.resizeWindows(forcePreview, false)4042 req(reqPrompt, reqList, reqInfo, reqHeader)4043 }4044 toggle := func() bool {4045 current := t.currentItem()
1225 unmodified lines