Commit Graph

129 Commits

Author SHA1 Message Date
Kartik K. Agaram 1f6ac6597c . 2021-11-11 08:56:45 -08:00
Kartik K. Agaram f43a1c7da0 edit a single hard-coded definition in the image
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.
2021-11-10 23:20:59 -08:00
Kartik K. Agaram 3d6c80e08e . 2021-11-10 22:40:36 -08:00
Kartik K. Agaram 9a49b92703 . 2021-11-10 22:15:13 -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
Kartik K. Agaram 8dcf08565d main function for other apps besides life.teliva 2021-11-10 16:48:42 -08:00
Kartik K. Agaram 0344a4c9a1 extract side-effect from 'update' 2021-11-10 16:39:33 -08:00
Kartik K. Agaram d5e2d7a0fd .
one more implication:
- the menu table. It feels natural to define it alongside keyboard
  input. However, it may then not be initialized during the first paint
  of the app.

I'm not sure how I feel about the menu data structure being defined far
away from the `update` function. Recipe for it to go out of date.
2021-11-10 16:36:01 -08:00
Kartik K. Agaram aec68ea8a2 no, initialize globals in symmetry with functions
Current plan: definitions can have arbitrary code. They'll be loaded
lazily when a specific name is invoked but has no binding. Implications:

- It'll be the responsibility of the code to define the name it's saved
  in. "Phony" names will result in some fragments of code repeatedly
  executing.

- Assigning a global to nil is a way to retrigger its initialization the
  next time it's needed.

I'm not sure how I feel about this sort of incompatibility with Lua. I
suppose we could avoid it by also tracking what definitions have already
been loaded in a run.
2021-11-10 16:28:37 -08:00
Kartik K. Agaram 82ffc6e20c put all code into some function 2021-11-10 15:56:05 -08:00
Kartik K. Agaram d3495adda7 remove upstream Readmes
They're already growing bitrot.
2021-11-10 15:50:13 -08:00
Kartik K. Agaram 2b3036b9d7 life: fix loaf pattern 2021-11-10 14:55:06 -08:00
Kartik K. Agaram c9546d3523 life: bugfix in up arrow 2021-11-10 14:48:31 -08:00
Kartik K. Agaram dc05a10e23 life: move starting pattern around on the screen
This assumes we're doing it early soon after opening a new pattern, when
it hasn't yet reached the margins. Quick and dirty, but seems good
enough.
2021-11-10 14:26:38 -08:00
Kartik K. Agaram 38f46a4e92 . 2021-11-10 13:48:56 -08:00
Kartik K. Agaram 4914b5d08f why do we refresh screen after reading keyboard? 2021-11-10 13:03:25 -08:00
Kartik K. Agaram dab2a1fbf3 load standard Game of Life pattern files 2021-11-10 09:44:22 -08:00
Kartik K. Agaram d2d388ffdc some commandline options for life.teliva 2021-11-10 09:01:19 -08:00
Kartik K. Agaram 43724435fe drop an obsolete build target 2021-11-10 08:35:08 -08:00
Kartik K. Agaram b397edcfbd . 2021-11-09 20:52:53 -08:00
Kartik K. Agaram 6a89795395 . 2021-11-08 19:12:06 -08:00
Kartik K. Agaram 689d6d840f state priorities in Readme 2021-11-08 19:09:28 -08:00
Kartik K. Agaram 7def405806 . 2021-11-07 15:39:27 -08:00
Kartik K. Agaram 16de70882a more tweaks to Readme 2021-11-07 15:33:02 -08:00
Kartik K. Agaram 18aaa7ff68 . 2021-11-07 15:26:12 -08:00
Kartik K. Agaram 72e64d79d6 . 2021-11-07 15:24:48 -08:00
Kartik K. Agaram e922cdbf16 . 2021-11-07 10:35:57 -08:00
Kartik K. Agaram 6dcce7056a update screenshot 2021-11-07 10:31:33 -08:00
Kartik K. Agaram ef9c42084d switch menu bars to reverse video 2021-11-07 10:29:29 -08:00
Kartik K. Agaram d5eb2fb752 update screenshot 2021-11-07 10:16:38 -08:00
Kartik K. Agaram 1f3ed8210d delete some Lua 5.1 things
These are likely to suffer bitrot.
2021-11-07 10:09:27 -08:00
Kartik K. Agaram 2b7ffea316 fix menu colors
I had it switching to a dark background on me.
2021-11-07 08:06:42 -08:00
Kartik K. Agaram 22f1624728 better support light backgrounds
Thanks nicolas decoster for reporting this issue.
2021-11-07 08:04:33 -08:00
Kartik K. Agaram 40fdaf2a2a more obvious phrasing
Early returns are only worthwhile if they're utterly obvious.
2021-11-07 06:30:15 -08:00
Kartik K. Agaram 51d6ae77d2 fix a regression in commit ee85ad384f 2021-11-07 06:28:24 -08:00
Kartik K. Agaram d79c83f209 . 2021-11-07 06:05:55 -08:00
Kartik K. Agaram 484575323b apps don't need to setlocale; it's hardcoded 2021-11-06 22:15:00 -07:00
Kartik K. Agaram 1d0d1fb31d . 2021-11-06 22:11:23 -07:00
Kartik K. Agaram ae5309bcbe syntax highlighting on GitHub 2021-11-06 22:03:12 -07:00
Kartik K. Agaram a8668eaf9f game of life
This required me to figure out some unicode-related nuances, but no new
primitives.
2021-11-06 21:49:23 -07:00
Kartik K. Agaram 8d1e5f6475 . 2021-11-06 19:21:10 -07:00
Kartik K. Agaram 5619f0117a window:nodelay() for non-blocking input 2021-11-06 19:21:01 -07:00
Kartik K. Agaram 8d5d27af0c . 2021-11-06 17:36:40 -07:00
Kartik K. Agaram 7df7fe446c . 2021-11-06 17:31:49 -07:00
Kartik K. Agaram 19472f7e65 . 2021-11-06 14:44:07 -07:00
Kartik K. Agaram 62ecf17870 escape hatch to quit with a pending error 2021-11-06 14:41:11 -07:00
Kartik K. Agaram 369eaeeaf1 . 2021-11-06 14:16:44 -07:00
Kartik K. Agaram fb022f5880 . 2021-11-06 14:13:39 -07:00
Kartik K. Agaram cba53ec9f6 reorg editor transitions 2021-11-06 13:22:05 -07:00
Kartik K. Agaram 3305ac0b90 start showing error messages in editor
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.
2021-11-06 13:10:22 -07:00