about summary refs log tree commit diff stats
path: root/template.tlv
Commit message (Collapse)AuthorAgeFilesLines
* zet.tlv: first screen testsKartik K. Agaram2022-03-101-3/+12
| | | | In the process I found a couple of bugs in fake screen primitives.
* screen tests: support bold, reverse, colorKartik K. Agaram2022-03-081-3/+99
| | | | | We can't test combinations of these yet because Lua 5.1 doesn't support bitwise operators. Reason #1 to upgrade.
* use method syntax where possibleKartik K. Agaram2022-03-061-7/+7
| | | | | | Perhaps this is a bad idea. It feels arbitrary, what methods Lua happens to include in string and table objects without having to go through the respective modules.
* move start_reading/start_writing out of templateKartik K. Agaram2022-03-061-48/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When should code go in the template used by new apps vs the .lua files distributed with Teliva? - from a privilege perspective there's no difference - from a compatibility perspective stuff in .tlv will not get upgraded with Teliva. - for me the maintainer, functions in .lua files are easier to upgrade in a single place. - for the reader of an app, functions in .lua files will not show up to be edited. They can still be overloaded, but the current version isn't as discoverable. Putting something in the app is a slight nudge to readers that they're encouraged to mess with it. - Stuff in .lua files can use local functions and so have more internal complexity. Apps can also hide details within functions, but that'll make them more likely to run into limitations with Teliva's editing environment. I'm not yet sure how to reason about the second point in practice. - Stuff in .tlv files I don't have to worry about compatibility guarantees for. - Stuff in .lua files I _do_ have to worry about compatibility guarantees for. Perhaps this means I'm doing things exactly wrong in this commit? Functions like map/reduce/filter/append seem more timeless, whereas I'm still just feeling my way around with start_reading and start_writing. We'll see. For now I'm ruled by the fourth point. Messing with tasks and the scheduler is much more advanced than anything else in template.tlv; it seems to make sense to add some friction to modifying them. Bottomline: Complex sub-systems go in .lua files. Simple, self-contained definitions go into apps. Both are probably equally burdensome now from a compatibility perspective.
* reconcile all apps with template.tlvKartik K. Agaram2022-03-061-56/+54
| | | | | | They may take more or less from it (sieve.tlv in particular takes nothing since call depth doesn't help at all there), but what they take is in the right order so that you can compare across apps.
* new API for file operationsKartik K. Agaram2022-03-051-0/+48
| | | | | | | | | | | | | | | | | | | | | File operations now always return a channel (or nil on error or permission denied). When start_reading() from a filename, you can repeatedly :recv() from the channel it returns. When :recv() returns nil, you're at the end of the file. Stop. When you start_writing() to a filename, you can repeatedly :send() to the channel it returns. When you're done writing, :close() the channel. Writes to the file won't be externally visible until you do. To make this work I'm now always starting up the scheduler, so I need to fix sieve.tlv. Transparently running the scheduler is an abstraction, and whenever I create an abstraction I always worry about how it might fail. There's a hopefully-clear error when you read past end of a file.
* anagrams.tlv: now fully responsiveKartik K. Agaram2022-03-051-6/+20
| | | | | | | | | If we press a key the computation now restarts instantly. There's no fiction of multi-threading in Teliva. If the application doesn't work right, it beach-balls. If it doesn't beach-ball under normal circumstances you're more certain it'll never beach-ball. It's more work up-front, but there's less variability in outcomes.
* basic support for testing writes to screenKartik K. Agaram2022-03-031-0/+73
|
* fake keyboard constructorKartik K. Agaram2022-03-021-0/+34
|
* distinguish between window global and argKartik K. Agaram2022-03-021-5/+5
|
* starting to make Teliva apps more testableKartik K. Agaram2022-02-271-3/+3
| | | | | | | | | | 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.
* import https://github.com/majek/lua-channelsKartik K. Agaram2022-02-261-2/+1
| | | | Also a little test program to demo channels in action.
* a little program for kids: anagrams of namesKartik K. Agaram2022-02-211-2/+62
|
* 'doc:blurb': a place to briefly describe an appKartik K. Agaram2022-02-171-0/+6
| | | | | | 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.
* standardize key order in .tlv filesKartik K. Agaram2022-02-091-2/+2
| | | | This will eliminate some spurious git diffs I keep having to clean up.
* more precise control over menu orderKartik K. Agaram2021-12-221-0/+2
| | | | I can't believe I didn't notice this until now.
* minor tweaksKartik K. Agaram2021-12-211-1/+1
|
* document dbgKartik K. Agaram2021-12-181-0/+2
|
* streamline an app; pull useful stuff into templateKartik K. Agaram2021-12-181-0/+32
|
* expand Teliva's "standard library"Kartik K. Agaram2021-12-161-0/+96
| | | | | | | | Lua is often not very functional. Available primitives often mutate data destructively rather than create new values. Perhaps I shouldn't be trying to go against the grain. We'll see. The above changes are based on using Teliva intensively for 2 weeks of Advent of Code 2021. But that isn't quite the ideal use case for Teliva.
* .Kartik K. Agaram2021-12-161-2/+2
|
* snapshot: migrate all sample apps to new formatKartik K. Agaram2021-12-111-72/+69
|
* a starting point for new appsKartik K. Agaram2021-11-271-0/+72