okay two commits this time because i got on a roll and forgot to devlog in between oops
the first one is mostly me cleaning up after myself lol. lib.rs in penumbra-ui had turned into a ~1000 line monster where everything lived, so i split it into app_state, editor_session, and universe. the editor’s one big 850 line rich_editor.rs got split too, into an engine, the formatting stuff, the markdown runs, and a small mod.rs on top. the markdown parser got the same treatment (builder, scanner, tags), and it now hands back the byte range of each block in the source text, plus it understands inline html and footnote refs like [^1] now. the old editor glue tests are gone because the old editor is gone. rest in peace little block editor, you were bad (LOLLLLLLLLLLL)
Full disclosure: i used AI to help clean up a LOT of the bad code here. some of what i’d written was genuinely rough (that 1000 line file did not get that way by accident lol) and having help untangling it and splitting it up sensibly saved me a ton of time. i still went through it and decided how things should be structured, duh, i’m not stupid
some actual editor stuff snuck in there too (while AI was modularizing, i was implementing):
- triple click selects the whole line
- shift+click extends your selection instead of throwing it away
- page up / page down
- option/alt + arrows for jumping by word
slint doesn’t give you a triple click so i had to fake one, with a click counter, a “did you click in basically the same spot” check, and a 400ms timer that resets it.
also slint on macOS maps Cmd to control and the actual Ctrl key to meta, which is backwards??? so now there’s a comment that says “which is wrong” and i handle both lol
the second commit is where things got fun hehe
cards were piling up on top of each other on the map. turns out collision avoidance only kicks in when a node has a bounding box, and new nodes didn’t get one until the UI measured them. so two notes that loaded on top of each other just… stayed there forever, happily overlapping. now every node gets a default card-sized box the moment it’s added, and there are a bunch of new layout tests that are literally “two cards stacked on each other, do they move apart” because i do NOT want that bug coming back
new notes also don’t spawn at random spots anymore. they go out in a golden angle spiral, like sunflower seeds. the comment says “the golden angle HEHEHEE” and i stand by that. collision got its own collision.rs too, and pinned cards never get shoved around
also on the map:
- an ambient settle loop that keeps nudging the layout until things calm down. it has a frame cap so it stops even if things keep jittering
- fit to view, so the camera frames all your notes, with min and max zoom so one note doesn’t fill the whole screen and 200 notes don’t turn into specks
- option + drag from one card to another draws a manual link!!! normal drag still moves the card
and then the funniest one. the app loaded the semantic embedding model at boot, said “embeddings ready”, and then… threw it away and kept using the dumb hash embedder lmaooo. it literally loaded it into a variable called _emb and never touched it again. now it actually uses the real model, and if that fails it falls back to the hash one and tells you it’s offline. the vector index also sizes itself to whichever embedder is active instead of hardcoding 384
the tests got split into folders as well (markdown, embed) because those files were getting enormous, and AI helped with some of that cleanup too.
feels so much better in here now :3
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.