about summary refs log tree commit diff stats
path: root/counter.tlv
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-02-27 08:38:48 -0800
committerKartik K. Agaram <vc@akkartik.com>2022-02-27 08:41:30 -0800
commitae51b06dabbae991914aff281ff42addbcd21146 (patch)
tree7a24f1d7f22409dd1a0110cf82f1a930e64db061 /counter.tlv
parent891bced5443cde47f51626d962e87df7d084a64c (diff)
downloadteliva-ae51b06dabbae991914aff281ff42addbcd21146.tar.gz
starting to make Teliva apps more testable
Tasteful apps should only perform side-effects through 'window'
arguments rather than the 'curses' module directly. It's ok however to
read constants like curses.A_NORMAL or curses.stdscr().

There are some limitations, unfortunately. Ncurses wasn't designed with
testability in mind. For example, there's no way to curs_set or
assume_default_colors without the 'curses' module. Oh well.
Diffstat (limited to 'counter.tlv')
-rw-r--r--counter.tlv4
1 files changed, 2 insertions, 2 deletions
diff --git a/counter.tlv b/counter.tlv
index 3cbe053..ccdcb0f 100644
--- a/counter.tlv
+++ b/counter.tlv
@@ -32,7 +32,7 @@
     >  window:mvaddstr(10, 11, n)
     >  window:attroff(curses.color_pair(6))
     >  window:attroff(curses.A_BOLD)
-    >  curses.refresh()
+    >  window:refresh()
     >end
 - __teliva_timestamp: original
   menu:
@@ -42,7 +42,7 @@
 - __teliva_timestamp: original
   update:
     >function update(window)
-    >  local key = curses.getch()
+    >  local key = window:getch()
     >  if key == 10 then
     >    n = n+1
     >  end