summaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2021-04-08 23:09:02 +1000
committerJesse Duffield <jessedduffield@gmail.com>2021-04-08 23:17:27 +1000
commitb03e2270a068c017a1e15810cfe980d9cf696a22 (patch)
tree6bc20810a35be2bc000b487578d6d54e1ebc034e /pkg
parent21049be2337c3ea8c5c30761eb9b8f5f9569950a (diff)
revert no-flicker due to carriage return weirdness
Diffstat (limited to 'pkg')
-rw-r--r--pkg/gui/tasks_adapter.go14
-rw-r--r--pkg/tasks/tasks.go14
2 files changed, 7 insertions, 21 deletions
diff --git a/pkg/gui/tasks_adapter.go b/pkg/gui/tasks_adapter.go
index d24344b49..bc2fb8a24 100644
--- a/pkg/gui/tasks_adapter.go
+++ b/pkg/gui/tasks_adapter.go
@@ -83,23 +83,13 @@ func (gui *Gui) getManager(view *gocui.View) *tasks.ViewBufferManager {
gui.Log,
view,
func() {
- // we could clear here, but that actually has the effect of causing a flicker
- // where the view may contain no content momentarily as the gui refreshes.
- // Instead, we're rewinding the write pointer so that we will just start
- // overwriting the existing content from the top down. Once we've reached
- // the end of the content do display, we call view.FlushStaleCells() to
- // clear out the remaining content from the previous render.
- view.Rewind()
+ view.Clear()
},
func() {
gui.g.Update(func(*gocui.Gui) error {
return nil
})
- },
- func() {
- view.FlushStaleCells()
- },
- )
+ })
gui.viewBufferManagerMap[view.Name()] = manager
}
diff --git a/pkg/tasks/tasks.go b/pkg/tasks/tasks.go
index 8287b3927..5854b4f46 100644
--- a/pkg/tasks/tasks.go
+++ b/pkg/tasks/tasks.go
@@ -33,13 +33,12 @@ type ViewBufferManager struct {
readLines chan int
// beforeStart is the function that is called before starting a new task
- beforeStart func()
- refreshView func()
- flushStaleCells func()
+ beforeStart func()
+ refreshView func()
}
-func NewViewBufferManager(log *logrus.Entry, writer io.Writer, beforeStart func(), refreshView func(), flushStaleCells func()) *ViewBufferManager {
- return &ViewBufferManager{Log: log, writer: writer, beforeStart: beforeStart, refreshView: refreshView, flushStaleCells: flushStaleCells, readLines: make(chan int, 1024)}
+func NewViewBufferManager(log *logrus.Entry, writer io.Writer, beforeStart func(), refreshView func()) *ViewBufferManager {
+ return &ViewBufferManager{Log: log, writer: writer, beforeStart: beforeStart, refreshView: refreshView, readLines: make(chan int, 1024)}
}
func (m *ViewBufferManager) ReadLines(n int) {
@@ -76,7 +75,7 @@ func (m *ViewBufferManager) NewCmdTask(r io.Reader, cmd *exec.Cmd, prefix string
loaded := false
go utils.Safe(func() {
- ticker := time.NewTicker(time.Millisecond * 200)
+ ticker := time.NewTicker(time.Millisecond * 100)
defer ticker.Stop()
select {
case <-ticker.C:
@@ -115,9 +114,6 @@ func (m *ViewBufferManager) NewCmdTask(r io.Reader, cmd *exec.Cmd, prefix string
default:
}
if !ok {
- // if we're here then there's nothing left to scan from the source
- // so we're at the EOF and can flush the stale content
- m.flushStaleCells()
m.refreshView()
break outer
}