Here's the second attempt of building my live-preview #Markdown editor:
I made some massive improvements! π
In fact, I think the last bug to fix is caret navigation using arrow-right key.
For example, if I navigate caret from left to right into a word with bold styling, it'll skip over the asterisks "**|word**" and move immediately to inside of range.
It works fine when navigating caret from opposite direction (right to left)... It's a minor detail, but important for a good UX.
#dev #macOS #AppKit #Swift #SwiftUI
Thread
Login to reply
Replies (3)
There is another bug⦠If I click on, say, a heading, and then afterwards click on another heading, the click position will be wrong. It seems to shift roughly 4 characters to the right.
This bug has been fixed β
Iβm surprised at how reliable the insertion and removal logic for syntax is. It seems to work perfectly!
I do need to implement logic so that syntax shows when making a text selection. This is the same behavior in Obsidian and I think itβs the right way.
Thereβs a critical bug that I need to solve.
If I type or remove a character in the editor, all the Markdown styling will be messed up and all line-breaks also seem to be removed.
This could potentially be a re-rendering problem where the `AttributedString` is being reset.