src/teliva counter.tlv
C-e # switch to editor
C-e # save and quit
C-x # exit
counter.tlv now has the same logical contents, though the whitespace has
changed, and the order of keys is different.
The implementation is utterly ghastly. For one, I'm unnecessarily
interfacing with kilo through the file system.
Before we'd end up in cryptic situations where error messages would get
hidden when the program got out of ncurses mode.
Now it's a little nicer with error messages showing up at the bottom of
the editor.
But there's still a problem: there's no way to abort without fixing an
error.
We're not going to enforce that the menu items actually do what they
advertise. It's just a way to draw on the bottom line of screen,
something apps aren't otherwise allowed to do.
Very satisfying to debug the difference between lcurses putting the
module table in an upvalue. Since I implicitly call initstr() rather
than define it as a primitive, I don't need to bother with that. I am
awesome. Lua is awesome for giving me that sense.
Not quite working. curses.stdscr() is returning userdata, not a window.
This is true even of the raw array example from the book. So we need to
learn something new here. How does lcurses's Pinitscr return a special
window object? From what I can tell it's just putting the results of
lc_newwin() on the stack. Which is the same as my curses_newwin() here.
First piece of working new vocabulary:
print(curses:cols())
Just pulling in code from lcurses for the most part. But I'm trying to
understand its internals as I gradually add them in, after my more blunt
first approach of packaging up lcurses/ext failed.
Overall plan for Teliva's API:
- start out with a 'curses' library that does what people who are used
to ncurses/lcurses expect.
- over time create a more opinionated library called 'screen' or
'window' or something.