Commit Graph

46 Commits

Author SHA1 Message Date
Kartik K. Agaram 542773df2f render functions in MRU order 2021-07-19 15:39:36 -07:00
Kartik K. Agaram bd538804db reorg primitives on screen 2021-07-02 19:31:15 -07:00
Kartik K. Agaram 9ae724e1ec preserve indentation of the sandbox 2021-06-20 23:07:23 -07:00
Kartik K. Agaram 8068b8450f more precisely track count of calls to eval
Before I only separately counted calls at each stack depth. I don't remember
if that seemed good enough or was just an oversight.
2021-06-15 12:28:52 -07:00
Kartik K. Agaram 0dda332ce3 .
Roll back to commit 70919b45f0. Recent commits add lots of extra function
args for dubious benefit.
2021-06-12 21:11:22 -07:00
Kartik K. Agaram 286819685e eliminate some implicit writes to real screen 2021-06-12 16:24:27 -07:00
Kartik K. Agaram 70919b45f0 .
Rename cells containing screens to screen vars because of the ambiguity
that each grapheme in fake screens is represented by a type screen-cell.
While we're at it, we also analogously rename keyboard vars.
2021-06-12 15:16:50 -07:00
Kartik K. Agaram 4bd1785c86 shell: larger fake screen 2021-06-12 10:46:28 -07:00
Kartik K. Agaram ef29fcdc91 cancel pending test
After all that, I'm not sure this is the desired behavior. If a function
defines multiple bindings, we shouldn't rename all their keys. So how to
choose?

Perhaps it's not so bad to have "symlinks" in this "file system". To unlink
two bindings you now need to define one of them in the sandbox.

All the refactoring is still useful, though.
2021-06-11 19:33:08 -07:00
Kartik K. Agaram 4de136fb85 . 2021-06-11 17:50:34 -07:00
Kartik K. Agaram 177fa96a93 . 2021-06-11 17:48:12 -07:00
Kartik K. Agaram c6e3bce981 . 2021-06-11 17:37:28 -07:00
Kartik K. Agaram be9fa3780a .
Add argument to a few functions.
2021-06-09 21:05:29 -07:00
Kartik K. Agaram 6169ec59c0 make tests pass again
I'm temporarily disabling the pending state. I'm also providing a clearer
error message when we encounter the bug.
2021-06-09 16:05:09 -07:00
Kartik K. Agaram b7e8c2810a snapshot: attempt at modifying a function name
It turns out there's another problem, and it predates the ability to create
new definitions:

  ctrl-s triggers a call to `evaluate`, which inserts a new definition
  into globals. which has a null gap buffer.

All this happens long before the new code in this commit, resulting in a
null gap buffer by the time we get to word-at-cursor.

Which in turn happens because we perform a raw `evaluate`, which doesn't
update the gap buffer like `run` does (using `maybe-stash-gap-buffer-to-global`).

And arguably `evaluate` shouldn't mess with the gap buffer. Gap buffers
are a UI concern.

The hardest version of this immediate scenario: It's unclear how to guarantee
that every definition have a gap buffer, when two definitions may share
one (closures sharing a lexical environment).

New plan:
  - improve the logic for detecting definitions. Looking at the outermost
    layer isn't enough. And a single expression can create multiple definitions.
  - extract a helper to attach a single gap buffer to multiple definitions.
  - have the UI detect conflicts in gap buffers and prompt the user for
    a decision if a different gap buffer already exists for a definition.
2021-06-09 09:16:52 -07:00
Kartik K. Agaram 206493b5e1 . 2021-06-08 21:09:05 -07:00
Kartik K. Agaram 139620e3d2 shell: function modal now also creates functions 2021-06-08 20:47:07 -07:00
Kartik K. Agaram e375f0104c shell: expand set of possible errors
Requires a change to mu.subx, to unify literal strings with generic
  (addr array _)
2021-06-08 20:21:39 -07:00
Kartik K. Agaram d2f2ac59b6 . 2021-06-08 19:33:51 -07:00
Kartik K. Agaram 0b56336ba8 a place for error messages in the function modal
Probably not ideal, but it's a start.
2021-06-08 19:28:34 -07:00
Kartik K. Agaram de013be794 ok, function modal now has full coverage 2021-06-08 18:09:17 -07:00
Kartik K. Agaram 25803914b3 . 2021-06-08 17:01:56 -07:00
Kartik K. Agaram 9b13d8858a first test for function modal 2021-06-08 16:47:23 -07:00
Kartik K. Agaram 1150170da0 . 2021-06-08 16:31:20 -07:00
Kartik K. Agaram 67aeff8934 .
I wrote a comment about how some code was not covered by tests, and then
promptly forgot what it was for. This is why we need tests.

Now the hack is gone.
2021-06-08 15:06:08 -07:00
Kartik K. Agaram 227d18f8a2 shell: first test for entire environment
This introduces some ergonomic issues. But we have to start somewhere.
2021-06-08 11:57:03 -07:00
Kartik K. Agaram 9922e558a3 handle navigating to a non-existent function
We need a place to show error messages. Maybe on the top row?
2021-06-06 21:46:42 -07:00
Kartik K. Agaram c4cf38773f more space for definitions 2021-06-06 10:54:50 -07:00
Kartik K. Agaram 48522591f8 refresh edited definitions on ctrl-s 2021-06-05 11:56:13 -07:00
Kartik K. Agaram 3d4e1b8b28 working on jumping to word at cursor
I had a nice clean definition for word-at-cursor, but it's wrong and I'm
going to have to mangle it.
2021-06-05 09:35:37 -07:00
Kartik K. Agaram 5a066f8dda start editing function definitions 2021-06-04 22:11:41 -07:00
Kartik K. Agaram 65e414911f run sandbox even when cursor in function 2021-06-04 22:05:51 -07:00
Kartik K. Agaram 4975bc82df bugfix: show functions after ctrl-g, enter 2021-06-04 22:05:02 -07:00
Kartik K. Agaram 73bbe731c5 select function to render first 2021-06-04 21:56:43 -07:00
Kartik K. Agaram 2177b38a68 conditionally display cursor on function side
Always shows at top-most function.
Can't actually do any editing yet.
2021-06-04 21:47:59 -07:00
Kartik K. Agaram 1f05bdcc34 conditionally display cursor in sandbox 2021-06-04 21:47:53 -07:00
Kartik K. Agaram d40dfea3ed modal dialog for function name to jump to 2021-06-04 21:47:36 -07:00
Kartik K. Agaram 1aba9c6f8e . 2021-06-04 20:14:45 -07:00
Kartik K. Agaram 55001994ef .
Keyboard state machine for jumping to function definition.
2021-06-04 20:13:38 -07:00
Kartik K. Agaram 81b3f72fb8 . 2021-06-04 19:58:20 -07:00
Kartik K. Agaram eb6758c61f . 2021-06-04 19:41:27 -07:00
Kartik K. Agaram 30745be5b5 . 2021-06-04 19:41:05 -07:00
Kartik K. Agaram 84bc03ab39 . 2021-06-04 19:40:06 -07:00
Kartik K. Agaram 4bb826b40e . 2021-06-03 20:55:42 -07:00
Kartik K. Agaram 1c6b965a7f starting to support function editing 2021-06-03 20:49:24 -07:00
Kartik K. Agaram 3ef69a05b0 . 2021-06-03 20:29:37 -07:00