I spent several hours trying to debug my notebook app last night, getting increasingly frustrated and demoralized. Eventually I realized there's a bug in my parser. It's a drag having to redo something I thought I was done with.
This morning I went back and built a debug UI for the parser, and now it shows the bug at a glance. The parse tree in the background is for the line the mouse pointer is hovering on.
I need to learn to switch gears more quickly from:
"This should be easy, I suck."
to:
"I'm having trouble with this, it must be hard."
One fun thing is the couple of lines in the middle there. I reached for a notebook to scribble some equations for myself, but then realized all I wanted was to be able to draw the fraction line horizontally -- and I'm sitting in a tool that can do that. Using the tool to debug the tool :boom: (At least until I have no tools because I broke my tools using my tools.)
It looks like I care about always making the styling very transparent, so it's possible in principle to guess what characters one needs to type to copy the look of something one sees on screen. So the style directives will never be hidden.
Regular lines are prose, but you can also insert named blanks into them using the syntax [value|name], which renders vertically across 2 lines. You can't nest blanks within blanks. These lines can wrap, but a single blank can't wrap across multiple lines on screen.
Indented lines (though the indentation is currently subtle) are code. They can render fractions using the syntax (a/b)as I showed before. (Not sure I'll keep this in the long term.) You can nest fractions within fractions. These lines don't support wrapping.
Planned:
synchronizing blanks with the same name
using code in indented lines to compute derived names without values inline
It takes only 20 lines of code to implement the core of the Mandelbrot set. But then it takes 20 lines to specify the palette. And 100 lines to adjust the viewport in response to touch events. And another 10 lines to render at lower precision while touches are in progress.
This does run into the limits of floating-point precision at some high level of zoom.
"Sokoban puzzles crafted with the express aim of being tiny, tight and foundational for Sokoban idiom.. Effortlessly teaching you an entire language of mechanics through focused and methodical exploration of a ruleset." — a nice 2-minute video review
While I recently made text2.love easy to embed in other LÖVE projects and documented its API, the true interface of this thing doesn't lie in how you wire it up its bog-standard handlers. No, it's what you do in a workhorse internal method called I.get_rect which gets called on every frame and for every input event.
Here's a very silly example of the sort of app that is now easier to create:
Max Bernstein and I have been playing with and putting together a rudimentary 0-dependency cross-platform platform for GUIs. Standing on the shoulders of Fenster and microUI, 2KLoC to support Linux, Windows and Mac without any SDL. (No shade on SDL, though.)
Now that I have a nice design for a text editor widget, I've been putting it through its paces, particularly for ideas like syntax highlighting and something I call "syntax geometry". Here's a kinda whimsical toy where '+' flips the direction of writing from horizontal to vertical and vice versa.
I only had to put this rule in in one place, and all my support for editing, moving and clicking on the screen to position the cursor continues to work.
(I did need to generalize a couple of things to get to this point.)