Commit Graph

17 Commits

Author SHA1 Message Date
Kartik K. Agaram 394c9f894c fix a few sample apps
Broken since Mar 18, when I started running tests in src/file.lua.

It's more than a little ugly that .lua files in src/ require helpers
inside .tlv apps.
2022-04-11 22:43:26 -07:00
Kartik K. Agaram 68d956e31a distinguish between window global and arg 2022-03-02 22:15:01 -08:00
Kartik K. Agaram ae51b06dab 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.
2022-02-27 08:41:30 -08:00
Kartik K. Agaram 9421ea7151 'doc:blurb': a place to briefly describe an app
This is for what the app does, as opposed to 'doc:main', which is also
intended to include commentary about the internal organization of the
app.
2022-02-17 20:16:36 -08:00
Kartik K. Agaram e552571b1e standardize key order in .tlv files
This will eliminate some spurious git diffs I keep having to clean up.
2022-02-09 09:18:05 -08:00
Kartik K. Agaram 343316dcfa more precise control over menu order
I can't believe I didn't notice this until now.
2021-12-22 00:27:50 -08:00
Kartik K. Agaram 41bf615f43 nail down trusted Teliva channels a little more
In each session, Teliva has to bootstrap a trusted channel with the
computer owner while running arbitrarily untrusted code. So let's get
really, really precise about what the trusted channel consists of:
  - the bottom-most row of screen containing the menu
  - the keystrokes the owner types in
  - ncurses COLOR_PAIR slots 254 (menu) and 255 (error)

One reason the menu colors are important: we don't want people to get
used to apps that hide the menu colors by setting default
foreground/background to invisible and then drawing their own menu one
row up.

The error COLOR_PAIR I don't see any reason to carve out right now, but
it seems like a good idea for Teliva the framework to not get into the
habit of apps doing some things for it.

I'm not sure how realistic all this is (I feel quite ill-equipped to
think about security), but it seems worthwhile to err on the side of
paranoia. Teliva will be paranoid so people don't have to be.
2021-12-21 15:47:55 -08:00
Kartik K. Agaram c0c9d31688 snapshot: migrate all sample apps to new format 2021-12-11 10:22:53 -08:00
Kartik K. Agaram d9cf3433d9 start showing call stack on errors
It turns out Lua has been providing us this information all along! I'd
just not created the space on screen to show it. Make it persist better.

Kilo now no longer tracks its own status messages, which is a regression
in a rare condition.
2021-12-04 14:12:36 -08:00
Kartik K. Agaram 31816db0cc . 2021-11-26 21:56:22 -08:00
Kartik K. Agaram 07bf55b460 save timestamp on change; show in recent changes 2021-11-26 18:47:50 -08:00
Kartik K. Agaram 5a63a5ca40 monotonically accumulate versions of definitions
One old drawback now has a new look. Before, we loaded definitions in
order, so global definitions had to exist before other global
definitions that used them. See window and grid in life.tlv. Now we load
definitions in reverse order, so initialization needs to change. Worse,
if we update window, we need to edit grid just to fix the order.

This implies that we can't yet optimize away bindings where there are no
new changes.
2021-11-24 10:10:38 -08:00
Kartik K. Agaram acb5e88b3c indent 2021-11-23 22:03:14 -08:00
Kartik K. Agaram 32517f428c consistent style 2021-11-23 22:03:00 -08:00
Kartik K. Agaram 5be743324c slightly more robust on-disk format
Looks like Lua supports a little bit of programmability in its
multi-line string literals. Even though I can't find this documented
anywhere.
2021-11-14 00:52:25 -08:00
Kartik K. Agaram 3d6c80e08e . 2021-11-10 22:40:36 -08:00
Kartik K. Agaram efbb57d339 new .tlv image format
Plan is for this to be the default representation for Teliva programs.
Text-friendly but not meant to be edited directly as text. Will
eventually include both code and data definitions, both current snapshot
and past revision history.

Right now .tlv files seem to run. Error checking is non-existent,
because I don't understand Lua's idioms around 'status' yet. Opening the
editor expectedly segfaults.

This commit is the most mind-bending bit of code I've written in a long
time.
2021-11-10 22:09:12 -08:00