Skip to content
Myr

Fix scrollbar rendering (#3096)

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 088293f · Browse files · 1 file+11 added−6 removed
This commit

State

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

Diff stats

1 file+11 added−6 removed

  • other:+11 added−6 removed

1 file+11 added−6 removed

modified:src/terminal.go+11 added-6 removed
1419 unmodified lines
1420 // Avoid unnecessary redraw1421 newLine := itemLine{current: current, selected: selected, label: label,1422 result: result, queryLen: len(t.input), width: 0, bar: bar}1423 prevLine := t.prevLines[i]1424 printBar := func() {1425 if len(t.scrollbar) > 0 && bar != prevLine.bar {1426 t.move(line, t.window.Width()-1, true)1427 if bar {1428 t.window.CPrint(tui.ColScrollbar, t.scrollbar)1429 }1430 }1431 }14321433 if prevLine.current == newLine.current &&1434 prevLine.selected == newLine.selected &&1435 prevLine.label == newLine.label &&1436 prevLine.queryLen == newLine.queryLen &&1437 prevLine.result == newLine.result {1438 printBar()1439 return1440 }14411442 t.move(line, 0, false)
25 unmodified lines
1468 fillSpaces := prevLine.width - newLine.width1469 if fillSpaces > 0 {1470 t.window.Print(strings.Repeat(" ", fillSpaces))1471 }1462 if len(t.scrollbar) > 0 && bar != prevLine.bar {1463 t.move(line, t.window.Width()-1, true)1464 if bar {1465 t.window.CPrint(tui.ColScrollbar, t.scrollbar)1466 }1467 }1472 printBar()1473 t.prevLines[i] = newLine1474}14751476func (t *Terminal) trimRight(runes []rune, width int) ([]rune, bool) {
1839 unmodified lines