For the past month I've been doing something very ...
# devlog-together
k
For the past month I've been doing something very unnatural for myself: "throwing the first one away." Going back and rewriting an aspect of a working program just to improve one property of the code rather than the behavior: eliminating all derived data structures and re-deriving everything all the time in a performant way. The result is a simpler API that seems applicable to pixel-based editors that use proportional fonts. Basically the problem is: as you do line-wrapping on a screen, how do you deal with interactive operations like clicking at a pixel coordinate or pressing the down arrow (which might result in a scroll). These primitives seem to make the implementation fairly self-evident: https://git.sr.ht/~akkartik/lines2.love/tree/main/item/move.lua#L11-28
🍰 4
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.) Can anyone think of potential uses for syntax geometry?
🍰 3
i
Really interesting! Reminds me of Befunge for some reason.
❤️ 1
k
Also some talk by Alan Kay where he shows a DSL based on ASCII representations of diagrams, used for implementing a network stack. But then, if I give up the simplicity of linear chains of characters, I guess I'd go for real diagrams without the limitation of the character grid. Like @guitarvydas does.
k
There's no character grid here since it's a proportional font 🙂 My very simple motivation here is WYSIWYG experiences for notations like:
Copy code
1
---
n+1
Or math summation notation. So there isn't a clear line here between linear chains of characters and "real" diagrams. The membrane is porous.
💯 1
m
I immediately thought about ASCII diagrams, if the direction can be any of right, down, left, up it would make it really easy 🙂
🙂 1
g
for fun, try to use em-dashes instead of "abcdefgh" and or-bars for "ijklmn" (em-dash == minus sign that's just a bit longer and contains no white pixels at the ends of the dash -- could use minus sign as above, leaving the result looking "dashed" (as above 1/(n+1)), and "or bar" == "|"). And, try Unicode instead of ASCII --> many more possibilities (incl. arrowheads and the like). Once done, pour it through t2t (text-to-text transpilation) to transpile to LaTeX (i.e. use LaTeX as assembly code).
FWIW, the above comments about "grids" led me down this path: https://programmingsimplicity.substack.com/p/character-grids-vs-overlapping?r=1egdky
i
There's an interesting difference between what you've made, Kartik, which I would describe as a "first-person draw-er" and something like Monodraw, which I would describe as a "third-person draw-er", to borrow from video game jargon. I wonder what other ideas would support the first-person approach.
💡 2
k
"First-person drawer" makes me think of Logo's turtle graphics. Which looks indeed much like what @Kartik Agaram is doing here.