Commit Graph

454 Commits

Author SHA1 Message Date
Kartik K. Agaram
53f235fd26 minor tweaks 2021-12-21 15:06:43 -08:00
Kartik K. Agaram
7eaca58762 gemini: ctrl-g to open a new page 2021-12-21 14:12:17 -08:00
Kartik K. Agaram
5c46538d2d start of a gemini browser 2021-12-20 12:19:05 -08:00
Kartik K. Agaram
c4984c2ae5 fix stale readme 2021-12-20 07:05:50 -08:00
Kartik K. Agaram
dcef2347dd document dbg 2021-12-18 19:33:54 -08:00
Kartik K. Agaram
59f223e7cb toot-toot: save prose somewhere
This is still quite klunky. Don't expect toot-toot to be a complete text
editor. In particular, it'll happily lose toot data if you try to edit
the app while editing a toot. Teliva is paranoid about avoiding data
loss, but toot-toot.tlv is not.

Mostly I just want toot-toot to interact with the clipboard. The only
reason save exists is that copying directly from within the app inserts
spurious line breaks. So now I'm saving to file, then `cat`ing file,
then copying each toot out.

I initially tried to use ctrl-s for the save hotkey, but that conflicts
with terminal flow-control, and it's not obvious how ncurses manages
IXON. And I don't want to go around ncurses and do something that's very
likely to be unportable.

Even ctrl-w, I worry that there are terminals out there that will close
tab or something stupid like that.

Feature wish list:
  - a hook to execute after exit. Just calling os.exit() doesn't work
    because the screen still clears any final prints when Teliva exits.
    Not sure how to handle this. Ncurses doesn't seem to have anything
    beyond endwin() for cleaning up after itself.
  - a hook to execute before exit, for things like asking for confirmation/save
  - a place for 'flash' notification messages, like that the file was saved
2021-12-18 09:45:13 -08:00
Kartik K. Agaram
d818efb7c8 pay more attention to where we display the cursor
It's still just in app control; I'm resisting the urge to introduce
"smarts".
2021-12-18 09:32:37 -08:00
Kartik K. Agaram
9fe884c03a streamline an app; pull useful stuff into template 2021-12-18 08:41:19 -08:00
Kartik K. Agaram
191538baf7 drop ASan from Makefile
Accidentally added at some point. It's a useful debugging aide, but I
don't want to require the additional dependencies on a first run.
2021-12-18 07:58:18 -08:00
Kartik K. Agaram
c55c5a7b0c mention programming framework in Readme 2021-12-18 07:55:55 -08:00
Kartik K. Agaram
1d9a4fa1d5 ctrl-u: clear prose 2021-12-17 23:19:59 -08:00
Kartik K. Agaram
235e103824 bug: handle digits in prose
Lua has some Javascript-esque gotchas here. Too quick to coerce between
types.
2021-12-17 23:10:13 -08:00
Kartik K. Agaram
67264c86f8 clean up cursor_up 2021-12-17 23:03:23 -08:00
Kartik K. Agaram
04a9a63fc0 two implementations of cursor_up 2021-12-17 23:00:52 -08:00
Kartik K. Agaram
caccafbc2c better copy on test failures 2021-12-17 22:38:00 -08:00
Kartik K. Agaram
d6129cd571 correct count of test failures 2021-12-17 22:35:21 -08:00
Kartik K. Agaram
42b1bd842c keep tests from messing up big picture 2021-12-17 22:23:18 -08:00
Kartik K. Agaram
c12ba48a63 one more protection against Lua stack leak 2021-12-17 22:23:18 -08:00
Kartik K. Agaram
92fe487349 experimental support for test errors 2021-12-17 22:23:17 -08:00
Kartik K. Agaram
580501b342 start of a test framework
Follows https://github.com/akkartik/wart, https://github.com/akkartik/mu0,
https://github.com/akkartik/mu1 and https://github.com/akkartik/mu.
2021-12-17 22:23:17 -08:00
Kartik K. Agaram
3921337b3f yet another stab at reorganizing stack assertions 2021-12-17 21:32:32 -08:00
Kartik K. Agaram
a617b3e5ac . 2021-12-17 11:37:34 -08:00
Kartik K. Agaram
166c8e0ca0 . 2021-12-17 08:55:08 -08:00
Kartik K. Agaram
12b0a2a7b6 more protection against data loss 2021-12-17 08:46:11 -08:00
Kartik K. Agaram
59ef5da1d9 . 2021-12-17 08:39:31 -08:00
Kartik K. Agaram
18f9f4e4f4 protect against data loss in some rare situations
Examples:
  - you try to write file but disk is full
  - you have two Teliva files being edited at the same time

Both are situations where it's impossible to avoid some data loss.
However, we should now at least have some valid state of the .tlv file
saved to disk where we'd previously end up with a zero-size file or
garbage.
2021-12-16 21:27:45 -08:00
Kartik K. Agaram
2a6786fee5 fix another leak in the Lua stack
This fixes a segfault when scanning through a long history of recent
changes (say > 20 changes)
2021-12-16 20:53:50 -08:00
Kartik K. Agaram
f979002939 more consistently show notes in recent changes
Teliva emits timestamps in multi-line format end in a newline. As a
result, notes get rendered on the next line and are then immediately
overwritten by the contents of the definition.

This bug was masked by my hacky 'original' timestamps which don't use
multi-line format.
2021-12-16 20:22:12 -08:00
Kartik K. Agaram
65b38f96ba stop leaking on the Lua stack, redux
An empty stack is too rigorous a line to hold. Instead we'll just ensure
we leave the stack the way we found it.
2021-12-16 20:07:59 -08:00
Kartik K. Agaram
76ed8d30f4 Revert "stop leaking on the Lua stack"
This reverts commit 7c1b9d0b91.

The 'big hammer' isn't good enough. The recent changes view seems to
need state on the stack across invocations of the editor.
2021-12-16 04:02:37 -08:00
Kartik K. Agaram
68e008526a expand Teliva's "standard library"
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.
2021-12-16 02:53:17 -08:00
Kartik K. Agaram
5872a7be09 . 2021-12-16 02:52:52 -08:00
Kartik K. Agaram
7c1b9d0b91 stop leaking on the Lua stack
..even if at the expense of leaking on the heap. Because the Lua stack
has very limited space (~20 slots). When it overflows, we segfault.
2021-12-16 02:50:32 -08:00
Kartik K. Agaram
b425593af6 show all functions in big picture
We were missing functions in some larger programs.
2021-12-13 09:59:52 -08:00
Kartik K. Agaram
d043d67744 tweak Hanoi colors yet again 2021-12-13 09:43:25 -08:00
Kartik K. Agaram
f315e1d76a can again edit notes on changes 2021-12-11 15:30:33 -08:00
Kartik K. Agaram
b9877fabdc . 2021-12-11 14:59:00 -08:00
Kartik K. Agaram
706bdf63c1 delete an old file for comparison 2021-12-11 14:55:19 -08:00
Kartik K. Agaram
5c68906303 handle non-existent file 2021-12-11 14:01:34 -08:00
Kartik K. Agaram
d25c37f86b bring back commandline args 2021-12-11 10:36:35 -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
d5038fe514 snapshot: writing working?
This is a complete mess. I want to abstract reading multiline strings
behind a function, but the lookahead requirements for that are quite
stringent. What's a reasonable abstraction here?
2021-12-11 09:37:23 -08:00
Kartik K. Agaram
052c5501ac snapshot: key/value lines after multiline strings 2021-12-11 07:20:04 -08:00
Kartik K. Agaram
0b0a58da06 snapshot: start reading a new format
I really wanted to avoid getting into defining or parsing new file
formats. However, using the entire power of Lua is not ideal, as
described earlier in Konrad Hinsen's bug. In addition to everything
else, it's a vector for arbitrary code execution when someone loads an
untrusted image.

I could use JSON, but it requires ugly string escaping. Seems cleaner to
just use YAML. But YAML is complex and needs its own dependencies. If
I'm going to do my own, might as well make the multi-line string format
really clear.

I can't yet write the new format.
2021-12-11 00:43:26 -08:00
Kartik K. Agaram
469ad4e546 clearer description of editing experience 2021-12-10 14:22:25 -08:00
Kartik K. Agaram
47c8e9df22 comment 2021-12-08 22:37:54 -08:00
Kartik K. Agaram
653f9cc874 minor colorscheme tweak 2021-12-08 22:34:01 -08:00
Kartik K. Agaram
5a237bbcca display line numbers
Not my aesthetic choice, but essential at the moment for quickly
interpreting Lua errors.
2021-12-08 22:31:30 -08:00
Kartik K. Agaram
8a70fbd171 fix a use-after-free
Introduced Nov 28. Let's see if my intermittent segfaults stop now.
2021-12-08 16:47:59 -08:00
Kartik K. Agaram
71ce944e81 couple more primitives after Advent day 8 2021-12-08 00:40:22 -08:00