Redraw item if query string has changed

This commit is contained in:
Junegunn Choi 2017-02-24 02:30:11 +09:00
parent b29375c844
commit 0b940e4b2b
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -46,6 +46,7 @@ type itemLine struct {
current bool current bool
selected bool selected bool
label string label string
queryLen int
width int width int
result Result result Result
} }
@ -737,11 +738,13 @@ func (t *Terminal) printItem(result *Result, line int, i int, current bool) {
} }
// Avoid unnecessary redraw // Avoid unnecessary redraw
newLine := itemLine{current: current, selected: selected, label: label, result: *result, width: 0} newLine := itemLine{current: current, selected: selected, label: label,
result: *result, queryLen: len(t.input), width: 0}
prevLine := t.prevLines[i] prevLine := t.prevLines[i]
if prevLine.current == newLine.current && if prevLine.current == newLine.current &&
prevLine.selected == newLine.selected && prevLine.selected == newLine.selected &&
prevLine.label == newLine.label && prevLine.label == newLine.label &&
prevLine.queryLen == newLine.queryLen &&
prevLine.result == newLine.result { prevLine.result == newLine.result {
return return
} }