summaryrefslogtreecommitdiffstats
path: root/src/core.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2019-11-12 00:10:24 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2019-11-12 00:10:24 +0900
commit7e1c0f39e76864ad0aa4d5c88d074b1055a617a6 (patch)
treee75527bdd1f9beae9978c2b73fe068d94129f02a /src/core.go
parentdeccf20a359af9f7420be9dc6aad4c50d6b329e7 (diff)
'reload' action should reset --header-lines
Diffstat (limited to 'src/core.go')
-rw-r--r--src/core.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/core.go b/src/core.go
index c5ad2353..087c7df9 100644
--- a/src/core.go
+++ b/src/core.go
@@ -225,6 +225,12 @@ func Run(opts *Options, revision string) {
reading := true
ticks := 0
var nextCommand *string
+ restart := func(command string) {
+ reading = true
+ chunkList.Clear()
+ header = make([]string, 0, opts.HeaderLines)
+ go reader.restart(command)
+ }
eventBox.Watch(EvtReadNew)
for {
delay := true
@@ -245,9 +251,8 @@ func Run(opts *Options, revision string) {
case EvtReadNew, EvtReadFin:
clearCache := false
if evt == EvtReadFin && nextCommand != nil {
- chunkList.Clear()
clearCache = true
- go reader.restart(*nextCommand)
+ restart(*nextCommand)
nextCommand = nil
} else {
reading = reading && evt == EvtReadNew
@@ -271,9 +276,7 @@ func Run(opts *Options, revision string) {
reader.terminate()
nextCommand = command
} else {
- reading = true
- chunkList.Clear()
- go reader.restart(*command)
+ restart(*command)
}
}
snapshot, _ := chunkList.Snapshot()