Follow

Wow,

building a working text-editor to be used as main driver is kicking my ass right now, the depth of selection wizardry, like where the cursor ends up after text operations, is endless.

A lot of subtle things I've never really noticed until they were gone.

git.sr.ht/~rabbits/left/log

· · Web · 7 · 5 · 24

After a thousand back & forths, it's starting to behave like a proper text editor.

@neauoire once I added a repl mode to my editor I was really surprised how difficult it was to enforce that the prompt was read-only. so many bugs over something that felt so small!

selection is a beast too for sure, though I had much less trouble with that by sticking with a point+mark model like Emacs.

@technomancy yeah, the difficulty with this is exponential with proportional text XD..

@neauoire sounds like the right occasion to draw out and describe your algorithms on paper. or are you already doing that? :P

@theruran I've already gathered "most" primitives, git.sr.ht/~rabbits/left/tree/m

But everytime I think I've got it right, I do something with an expectation of where the cursor should end up, and I'm still wrong half the time..

@neauoire my mind is blown just looking at it. your patience will reward you!

@neauoire When I wrote my text editor years ago, that was one of the hardest thing I had to figure out.

In the end, I could write a program that would tell me where it needed to be, so I expanded that into something that wrote unit tests to make sure my "real" logic was correct.

Wasn't very efficient at 15k tests though, but at least it was only 8 seconds to run.

@neauoire No. I ended up writing four novels with it (~250k words), but then hit enough things that I couldn't fix without a massive restructure.

Then started over again about six more times over the next ~14 years. :D

@neauoire It's part of Author Intrusion, my attempt at writing an IDE for writing novels including refactoring, find usages, etc.

@neauoire If you were to maintain a list of specific concrete scenarios, that would be invaluable for "someone following in the future". Just as steps to perform and expected result.

@akkartik I will expand on my notes as I learn how to do it for sure. :)

@dokoissho I keep alternating between two designs for the copy/paste, but I think I found something I like this morning :)

@neauoire Is it working currently? I can select and delete text in docs but haven't been able to paste any text in from outside.

@dokoissho you need to put the text you want to bring into left in the .snarf file. That hasn't worked ?

@dokoissho look at the video just above to see how I do it with:

cat > .snarf

@ruby0x1 haha yeah, I don't think that'll fit. I even had to cut the ascii sheet in half to make it fit in memory..

Sign in to participate in the conversation
Merveilles

Revel in the marvels of the universe. We are a collective of forward-thinking individuals who strive to better ourselves and our surroundings through constant creation. We express ourselves through music, art, games, and writing. We also put great value in play. A warm welcome to any like-minded people who feel these ideals resonate with them.