Commit Graph

45 Commits

Author SHA1 Message Date
Kartik K. Agaram b5aca9a571 toot-toot: stop clobbering existing files
I've been reluctant to do this until now because it makes it more
difficult to grant an app the ideal permissions. Here's what I use:

  return string.find(filename, 'toot') == 1

But I'm also trying to keep people from looking to the app to figure out
what permissions to give it :/
2022-03-31 08:51:05 -07:00
Kartik K. Agaram 3618487289 toot-toot: disable ctrl-k
Rather than invest LoC in asking for confirmation or an undo feature,
just have people restart to clear the page.

I fucking suck for how many ways I can come up with to lose data in a
text editor. It really should have been fucking obvious that clearing
the page so easily was a footgun just waiting to happen.
2022-03-30 21:36:34 -07:00
Kartik K. Agaram b56590ddc9 some more reorg of the standard library
Now life.tlv and gemini.tlv are also minimizing how much of the standard
library they pull in, just to be easy to read.
2022-03-27 11:42:19 -07:00
Kartik K. Agaram 14446eefc4 helper: count permutations 2022-03-27 11:24:56 -07:00
Kartik K. Agaram dd7da2c62a helper: count 2022-03-27 10:53:41 -07:00
Kartik K. Agaram fddbe08fc8 graphviz: for basic stats, show all nodes ordered
The ordering is topological; nodes come before their dependencies.

Also some more helpful functions in the template for new apps.
2022-03-19 16:59:30 -07:00
Kartik K. Agaram 7859317ece standardize common helpers across all apps
In particular, I merged take_out in anagrams.tlv with all_but in
graphviz.
2022-03-19 00:19:58 -07:00
Kartik K. Agaram aed89b8d35 graphviz: draft notion of nodes in 'focus'
Now the REPL isn't about deciding what to calculate, but just what nodes
to calculate it for.
2022-03-18 21:22:18 -07:00
Kartik K. Agaram 29d53c21ac graphviz: don't interpret substrings as regexes 2022-03-18 10:43:48 -07:00
Kartik K. Agaram 5c42b1de32 break.tlv: nascent live-updating stack language
Joint work with Sumeet Agarwal. In the process we discovered several
bugs in our fake window helpers for tests. Thanks Sumeet!

Previous prototypes:
  - https://archive.org/details/akkartik-2min-2020-12-06
  - https://merveilles.town/@akkartik/105759816342173743
2022-03-17 23:36:15 -07:00
Kartik K. Agaram 6ece3bb664 toot-toot.tlv: scrolling 2022-03-12 09:06:12 -08:00
Kartik K. Agaram 6a3098d0e9 use method syntax where possible
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.
2022-03-06 16:38:49 -08:00
Kartik K. Agaram a8d0c1a56a reconcile all apps with template.tlv
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.
2022-03-06 02:42:34 -08: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 0e19efeb2e fix a conflicting keyboard shortcut 2022-02-17 19:44:26 -08:00
Kartik K. Agaram e397220f9d Lua gotcha: iterating over strings yields strings 2022-02-08 19:19:08 -08:00
Kartik K. Agaram 00db37f064 toot-toot: gracefully handle lack of permissions
This opens up a whole new can of worms: Teliva's ability to show clear
error messages hinges on apps having decent error handling.

I suppose that's ok. A new app someone downloads that throws out strange
error messages and puts them in the equivalent of the console doesn't
exactly engender trust. It's reasonable to treat poor error handling as
breakage.

Here's my running list of open questions from working on the permissions
screen so far:
  - how to teach people to care about the difference between:
    - permissions known to be unsafe
    - permissions unknown to be safe
  - how to show syntax errors in the permissions screen
  - how to detect syntax errors in the permissions screen (lots of stuff
    only shows up when running)
  - how to deal with apps with poor error handling (this commit; punt for now)
  - how to engender skepticism in people towards what apps tell them
    ("oh, just go into the permissions screen and type ___ to fix this error")
  - how to help people judge the quality of their permissions
    (mode == 'r' vs mode ~= 'w')
2022-01-03 08:20:05 -08:00
Kartik K. Agaram bacf8fc92e toot-toot: support backspace on Mac 2021-12-23 14:53:20 -08:00
Kartik K. Agaram 3dae8ffc3b toot-toot: cursor_down now handles wrapping lines 2021-12-23 12:58:31 -08:00
Kartik K. Agaram 996519c204 clean up debug prints 2021-12-23 12:34:50 -08:00
Kartik K. Agaram a5533d7940 toot-toot: plug width into cursor movement 2021-12-23 12:33:41 -08:00
Kartik K. Agaram 984d345089 toot-toot: reorg definitions 2021-12-23 11:24:44 -08:00
Kartik K. Agaram 34e1595922 toot-toot: clean up history 2021-12-23 11:09:01 -08:00
Kartik K. Agaram a2cb3da0c9 toot-toot: cursor_up now handles wrapping lines 2021-12-23 11:08:56 -08:00
Kartik K. Agaram c1bcd566e9 snapshot: more tests for cursor_up
I think this may be all the tests. Now to make them pass..
2021-12-23 10:42:57 -08:00
Kartik K. Agaram 7a7a334a5d toot-toot: more elaborate cursor_up 2021-12-22 20:28:58 -08:00
Kartik K. Agaram 2c76aa9ff0 toot-toot: more verbose but clearer cursor_down
I actually got all tests to pass on the first try.
2021-12-22 18:44:03 -08:00
Kartik K. Agaram 77b464fbf0 clean up my debug conlang
This isn't the ideal implementation either. Pure spaghetti. But I need
to clean up the debug prints to see that.
2021-12-22 17:48:18 -08:00
Kartik K. Agaram 940b885be7 toot-toot: redo cursor_down as an experiment
I want to support cursor movement across wrapped lines, and the old
implementation doesn't seem on the right track for that.

Interesting that this required me to add the new symmetric test.
2021-12-22 17:45:51 -08:00
Kartik K. Agaram c393528cd2 . 2021-12-22 17:39:31 -08:00
Kartik K. Agaram e7a73626e8 toot-toot: a few more tests
..before a change in approach.
2021-12-22 11:54:54 -08:00
Kartik K. Agaram 0a1d5d61cb . 2021-12-22 11:41:45 -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 53f235fd26 minor tweaks 2021-12-21 15:06:43 -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 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 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