summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2020-10-24 16:55:55 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2020-10-24 16:55:55 +0900
commit03c4f042463b2cf96dbb05fdbd06cfbb4903e6c8 (patch)
tree76318ded4f4caacfc0139902dcd7f33a248d1198
parenta1f06ae27fdbbd3e0e59529e143efcf4ca1313d5 (diff)
Use 64-bit integer for preview version
-rw-r--r--src/terminal.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/terminal.go b/src/terminal.go
index 34db2c93..9801872f 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -43,7 +43,7 @@ const (
)
type previewer struct {
- version int
+ version int64
lines []string
offset int
enabled bool
@@ -53,7 +53,7 @@ type previewer struct {
}
type previewed struct {
- version int
+ version int64
numLines int
offset int
filled bool
@@ -284,7 +284,7 @@ type previewRequest struct {
}
type previewResult struct {
- version int
+ version int64
lines []string
offset int
spinner string
@@ -1752,7 +1752,7 @@ func (t *Terminal) Loop() {
if t.hasPreviewer() {
go func() {
- version := 0
+ var version int64
for {
var items []*Item
var commandTemplate string
@@ -1813,7 +1813,7 @@ func (t *Terminal) Loop() {
eofChan <- true
}()
// Goroutine 2 periodically requests rendering
- go func(version int) {
+ go func(version int64) {
lines := []string{}
spinner := makeSpinner(t.unicode)
spinnerIndex := -1 // Delay initial rendering by an extra tick
@@ -1855,7 +1855,7 @@ func (t *Terminal) Loop() {
}(version)
}
// Goroutine 3 is responsible for cancelling running preview command
- go func(version int) {
+ go func(version int64) {
timer := time.NewTimer(previewDelayed)
Loop:
for {
@@ -1976,7 +1976,7 @@ func (t *Terminal) Loop() {
case reqPreviewRefresh:
t.printPreview()
case reqPreviewDelayed:
- t.previewer.version = value.(int)
+ t.previewer.version = value.(int64)
t.printPreviewDelayed()
case reqPrintQuery:
exit(func() int {