fix: trigger a single log refresh after changing 'since' (#2202)
parent
b3029eefbd
commit
a2a7544a6f
|
|
@ -33,15 +33,16 @@ const (
|
|||
type Log struct {
|
||||
*tview.Flex
|
||||
|
||||
app *App
|
||||
logs *Logger
|
||||
indicator *LogIndicator
|
||||
ansiWriter io.Writer
|
||||
model *model.Log
|
||||
cancelFn context.CancelFunc
|
||||
cancelUpdates bool
|
||||
mx sync.Mutex
|
||||
follow bool
|
||||
app *App
|
||||
logs *Logger
|
||||
indicator *LogIndicator
|
||||
ansiWriter io.Writer
|
||||
model *model.Log
|
||||
cancelFn context.CancelFunc
|
||||
cancelUpdates bool
|
||||
mx sync.Mutex
|
||||
follow bool
|
||||
requestOneRefresh bool
|
||||
}
|
||||
|
||||
var _ model.Component = (*Log)(nil)
|
||||
|
|
@ -338,9 +339,12 @@ func (l *Log) Flush(lines [][]byte) {
|
|||
}
|
||||
}()
|
||||
|
||||
if len(lines) == 0 || !l.indicator.AutoScroll() || l.cancelUpdates {
|
||||
if len(lines) == 0 || (!l.requestOneRefresh && !l.indicator.AutoScroll()) || l.cancelUpdates {
|
||||
return
|
||||
}
|
||||
if l.requestOneRefresh {
|
||||
l.requestOneRefresh = false
|
||||
}
|
||||
for i := 0; i < len(lines); i++ {
|
||||
if l.cancelUpdates {
|
||||
break
|
||||
|
|
@ -364,6 +368,7 @@ func (l *Log) sinceCmd(n int) func(evt *tcell.EventKey) *tcell.EventKey {
|
|||
} else {
|
||||
l.model.SetSinceSeconds(ctx, int64(n))
|
||||
}
|
||||
l.requestOneRefresh = true
|
||||
l.updateTitle()
|
||||
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Reference in New Issue