From bf5cc5a21d038b04440e02bfa84a633feddc6fa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Stra=C3=9Fburger?= Date: Sun, 18 Sep 2016 04:33:59 +0200 Subject: [PATCH] :art: adding notify method to display temporary debug information --- termap.coffee | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/termap.coffee b/termap.coffee index 68c2aad..9384acd 100644 --- a/termap.coffee +++ b/termap.coffee @@ -85,6 +85,10 @@ draw = -> getStatus = -> "view: [#{view.toString()}] scale: [#{size}] columns: [#{process.stdout.columns}]" +notify = (text) -> + return if drawing + process.stdout.write "\r\x1B[K#{getStatus()} #{text}" + moving = null process.stdin.on 'mousepress', (info) -> # TODO: file bug @keypress, fails after x>95 / sequence: '\u001b[M#B' @@ -122,7 +126,10 @@ process.stdin.on 'keypress', (ch, key) -> else false - draw() if result + if result + draw() + else + notify JSON.stringify key process.stdout.on 'resize', -> init()