Commit Graph

112 Commits

Author SHA1 Message Date
Kartik K. Agaram e55d3f5814 maintain aspect ratio when rendering images 2021-07-29 08:24:27 -07:00
Kartik K. Agaram 63c7d5c4e0 downsampling photos makes the dithering seem worse
We support 128px, so let's use the whole 128px.
2021-07-29 07:55:54 -07:00
Kartik K. Agaram e9fb7e4453 shell: rendering image definitions
Not quite working yet. Only the very first rendering succeeds. After
that any keypress triggers a second render which aborts. Image is
getting corrupted in memory somehow.
2021-07-29 00:41:19 -07:00
Kartik K. Agaram fc951149a0 shell: support loading 128x128px images
I'm loading them in uncompressed ASCII format, and all streams and gap
buffers all over the place need to get massively scaled up to 256KB
capacity. But the tests don't yet run out of RAM, so I'll keep going.
2021-07-28 23:58:46 -07:00
Kartik K. Agaram e2f6e9011e saving definitions containing string literals
This was the whole proximal goal in implementing balanced terminals.

Printing these is still unreliable. It always surrounds in [], which may
not work.
2021-07-28 23:08:07 -07:00
Kartik K. Agaram 916d011753 . 2021-07-19 19:52:24 -07:00
Kartik K. Agaram c0db806820 . 2021-07-19 19:46:04 -07:00
Kartik K. Agaram 542773df2f render functions in MRU order 2021-07-19 15:39:36 -07:00
Kartik K. Agaram b22e6ebfe2 . 2021-07-17 00:23: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 3191861242 better name 2021-06-11 20:11:16 -07:00
Kartik K. Agaram cbf3de0f08 back to the pending test
I'm ready again to take on commit 6169ec59c after lots of refactoring.
2021-06-11 19:26:20 -07:00
Kartik K. Agaram 040b60bc6e .
Save a single trace to potentially multiple globals just like a gap buffer
(if say we have a single let binding defining multiple functions).

I don't have a strong use for this yet, but it seems cleaner. Maybe it's
redundant or wrong.
2021-06-11 19:17:08 -07:00
Kartik K. Agaram 6f64f5d3b6 . 2021-06-11 18:20:47 -07:00
Kartik K. Agaram c1e5ddfa54 . 2021-06-11 18:20:25 -07:00
Kartik K. Agaram 18c8e8c82f . 2021-06-11 17:54:04 -07:00
Kartik K. Agaram 4de136fb85 . 2021-06-11 17:50:34 -07:00
Kartik K. Agaram 6cc2cd6cb5 . 2021-06-11 17:32:22 -07:00
Kartik K. Agaram c29a10ac37 .
Inline a function by patching a few variable names. I don't even have to
worry about `return` statements if there's a single call and it's in tail
position in the caller.
2021-06-11 15:37:03 -07:00
Kartik K. Agaram cc679f4234 . 2021-06-11 15:34:02 -07:00
Kartik K. Agaram 995ff89c8e start showing parse errors under definitions
We don't have support for browsing them yet. Just errors for now, which
should only be a line or two. Larger traces might be useful for inspecting
results of macroexpansion.
2021-06-11 11:32:27 -07:00
Kartik K. Agaram 0b055331bc . 2021-06-11 11:24:49 -07:00
Kartik K. Agaram f6808302e5 . 2021-06-11 11:16:26 -07:00
Kartik K. Agaram 3e32a1b808 . 2021-06-09 21:52:07 -07:00
Kartik K. Agaram eb8260b227 . 2021-06-09 21:38:30 -07:00
Kartik K. Agaram a2d4e41583 . 2021-06-09 21:28:45 -07:00
Kartik K. Agaram be9fa3780a .
Add argument to a few functions.
2021-06-09 21:05:29 -07:00
Kartik K. Agaram 0aed24e222 . 2021-06-09 20:50:19 -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 d0d8fc7b04 . 2021-06-08 21:25:58 -07:00
Kartik K. Agaram 139620e3d2 shell: function modal now also creates functions 2021-06-08 20:47:07 -07:00
Kartik K. Agaram c1fff5ec14 shell: fleshing out the 'standard library'
Based loosely on Arc's arc.arc:
  http://arclanguage.org
  https://github.com/arclanguage/anarki/blob/official/arc.arc
2021-06-06 12:55:06 -07:00
Kartik K. Agaram 48522591f8 refresh edited definitions on ctrl-s 2021-06-05 11:56:13 -07:00
Kartik K. Agaram 5a066f8dda start editing function definitions 2021-06-04 22:11:41 -07:00
Kartik K. Agaram 7de9d457eb .
Menu when cursor is within a function.
2021-06-04 21:59:01 -07:00
Kartik K. Agaram 73bbe731c5 select function to render first 2021-06-04 21:56:43 -07:00
Kartik K. Agaram 7531bc2124 always render functions starting at the cursor
For now we just never render definitions above it. That will improve.
2021-06-04 21:48:35 -07:00
Kartik K. Agaram 11e8d83d61 record the definition the cursor is currently at 2021-06-04 21:48:29 -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 81b3f72fb8 . 2021-06-04 19:58:20 -07:00
Kartik K. Agaram bb1ccae27f rename the definition primitive to 'def' 2021-06-04 16:07:07 -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 d00f8dc6ca . 2021-06-03 20:37:51 -07:00
Kartik K. Agaram 6b34a1c9bf . 2021-06-03 14:55:33 -07:00
Kartik Agaram ccadba5b95 .
Until we get scrolling on functions, it's a little cleaner to draw the
primitives on top.
2021-05-31 20:40:08 -07:00
Kartik K. Agaram 35e0613849 shell: raise errors when loading code on boot 2021-05-30 19:12:20 -07:00