diff options
| author | Jeff Carr <[email protected]> | 2025-02-08 12:13:12 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-02-08 12:13:12 -0600 |
| commit | 77b4bcb94b64d327c8bb3b3df2cedacd7d9fdae6 (patch) | |
| tree | 68f951c98c47707377e6c9ad101485687c9af628 /init.go | |
| parent | 665d2289e2ce910326cacb2e6b8c35c5e241c279 (diff) | |
quiet refresh goroutine
Diffstat (limited to 'init.go')
| -rw-r--r-- | init.go | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -219,14 +219,15 @@ func waitOK() { } } -var lastRefresh time.Time - +// empty function. this triggers gocui to refresh the screen func testRefresh(*gocui.Gui) error { - log.Info("in testRefresh") + // log.Info("in testRefresh") return nil } +// refresh the screen 10 times a second func refreshGocui() { + var lastRefresh time.Time lastRefresh = time.Now() for { time.Sleep(10 * time.Millisecond) @@ -234,12 +235,13 @@ func refreshGocui() { if !me.ok { continue } - if time.Since(lastRefresh) > 1*time.Second { + if time.Since(lastRefresh) > 100*time.Millisecond { if me.mouse.mouseUp { - log.Info("refresh now on mouseUp") + // log.Info("refresh now on mouseUp") + // todo: add logic here to see if the application has changed anything me.baseGui.Update(testRefresh) } else { - log.Info("refresh skip on mouseDown") + // log.Info("refresh skip on mouseDown") // me.baseGui.Update() } lastRefresh = time.Now() |
