From 38d5129ff28adfba08ec136335ef1c739fa500c3 Mon Sep 17 00:00:00 2001 From: Michael Dvorkin Date: Sat, 5 Oct 2013 15:42:59 -0700 Subject: [PATCH] Moved paused rendering to screen --- cmd/mop.go | 6 +----- screen.go | 8 ++++++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/cmd/mop.go b/cmd/mop.go index 07b9b61..ca8a1af 100644 --- a/cmd/mop.go +++ b/cmd/mop.go @@ -68,11 +68,7 @@ loop: } } else if event.Ch == 'p' || event.Ch == 'P' { paused = !paused - if paused { - screen.Draw("\n Paused ") - } else { - screen.Draw("\n ") - } + screen.Draw(paused) } else if event.Ch == '?' || event.Ch == 'h' || event.Ch == 'H' { showingHelp = true screen.Clear().Draw(help) diff --git a/screen.go b/screen.go index 4a10e7e..99b8c94 100644 --- a/screen.go +++ b/screen.go @@ -82,6 +82,14 @@ func (screen *Screen) Draw(objects ...interface{}) *Screen { case time.Time: timestamp := ptr.(time.Time).Format(`3:04:05pm PST`) screen.DrawLine(0, 0, `` + timestamp + ``) + case bool: + timestamp := time.Now().Format(`3:04:05pm PST`) + if ptr.(bool) { + timestamp = `Paused ` + timestamp + `` + } else { + timestamp = ` ` + timestamp + } + screen.DrawLine(0, 0, `` + timestamp + ``) default: screen.draw(ptr.(string)) }