clean up flushing
This commit is contained in:
4
main.go
4
main.go
@@ -1,7 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
@@ -54,11 +53,12 @@ func listen(k *Keyboard, tp *TickPrinter, timer *Timer, stop func()) {
|
|||||||
case 'S':
|
case 'S':
|
||||||
timer.Sub(time.Minute)
|
timer.Sub(time.Minute)
|
||||||
case 'p':
|
case 'p':
|
||||||
|
tp.Flush()
|
||||||
timer.TogglePause()
|
timer.TogglePause()
|
||||||
case 'z':
|
case 'z':
|
||||||
fmt.Printf("\n")
|
|
||||||
tp.Flush()
|
tp.Flush()
|
||||||
case 'r':
|
case 'r':
|
||||||
|
tp.Flush()
|
||||||
timer.Reset()
|
timer.Reset()
|
||||||
case 'q':
|
case 'q':
|
||||||
stop()
|
stop()
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ func (t *TickPrinter) Start() {
|
|||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-t.flush:
|
case <-t.flush:
|
||||||
|
fmt.Printf("\n")
|
||||||
t.Print()
|
t.Print()
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
t.Print()
|
t.Print()
|
||||||
|
|||||||
Reference in New Issue
Block a user