Commit Graph

791 Commits

Author SHA1 Message Date
Kartik K. Agaram d72eae5978 create empty file when navigating to empty definition 2021-11-11 17:41:37 -08:00
Kartik K. Agaram e7f33de81e fix incorrect hotkey in menu 2021-11-11 17:32:50 -08:00
Kartik K. Agaram f6c7bf6fd0 ctrl-g to edit a different definition 2021-11-11 17:29:40 -08:00
Kartik K. Agaram 4d20e71c80 gracefully handle missing definition 2021-11-11 17:04:29 -08:00
Kartik K. Agaram 8398f8e2d1 . 2021-11-11 17:00:18 -08:00
Kartik K. Agaram a76cd9067a global for current definition being edited 2021-11-11 16:47:09 -08:00
Kartik K. Agaram d303c6efb0 pass lua_State into editor 2021-11-11 16:42:02 -08:00
Kartik K. Agaram 0d6378aa51 delete a helper that hides stack side effects 2021-11-11 16:32:08 -08:00
Kartik K. Agaram 7b389ce41e extract a few helper functions 2021-11-11 16:16:55 -08:00
Kartik K. Agaram 2d05f5090f . 2021-11-11 16:15:06 -08:00
Kartik K. Agaram 15e0ac70f9 . 2021-11-11 16:09:46 -08:00
Kartik K. Agaram 3e7ff252af reorg 2021-11-11 15:50:52 -08:00
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