Redraw item if query string has changed
This commit is contained in:
parent
b29375c844
commit
0b940e4b2b
@ -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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user