From 4835c24868628eafb7d5e601962d4bd72089b820 Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Mon, 17 Feb 2020 15:19:38 -0700 Subject: [PATCH] clean up flushing --- main.go | 4 ++-- tickprinter.go | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 04229af..e8c2f4d 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,6 @@ package main import ( - "fmt" "os" "os/signal" "syscall" @@ -54,11 +53,12 @@ func listen(k *Keyboard, tp *TickPrinter, timer *Timer, stop func()) { case 'S': timer.Sub(time.Minute) case 'p': + tp.Flush() timer.TogglePause() case 'z': - fmt.Printf("\n") tp.Flush() case 'r': + tp.Flush() timer.Reset() case 'q': stop() diff --git a/tickprinter.go b/tickprinter.go index e379f1a..6187064 100644 --- a/tickprinter.go +++ b/tickprinter.go @@ -32,6 +32,7 @@ func (t *TickPrinter) Start() { for { select { case <-t.flush: + fmt.Printf("\n") t.Print() case <-ticker.C: t.Print()