Thread

Zero-JS Hypermedia Browser

Relays: 5
Replies: 1
Generated: 00:07:09
In the current approach, I use an `NSTextView` in each block. This means, if you have two text blocks, there are going to be two separate `NSTextView`s. This is problematic, as it’s really difficult to make keyboard navigation feel natural when navigating the caret between the two text blocks. You know how when you use arrow up and down keys to navigate in some text, the x-position is remembered to ensure the caret stays in the same position on the horizontal axis. I do have a solution that mostly work, but I have a bug where _(I think)_ it resets the x-position on each up and down click. Shouldn’t be too difficult to fix. **However, there is another problematic issue:** Another problem is text selection. Selecting text across two different `NSTextView`s must be faked, as it does not work by default, so I need to implement a custom solution. **I see two options:** - I can continue with the current approach of using separate `NSTextView`s for each block, but this requires much debugging and custom solutions. Maybe I will never be able to get it perfect 🤷‍♂️ - Or, I can pivot and use one single NSTextView which is apparently what Apple Notes is doing. I’m not super familiar with `NSMutableAttributedString` and `NSAttributedString`, but apparently these allow for custom styling inside the same text string. For example, you can have a line with a bigger font size and then a line below with a smaller font size inside the same text paragraph. You can even add attachments inside the text with `NSTextAttachment`. I think this should also work for checkboxes. I will experiment with this new approach over the weekend. Hopefully, I can get something working. #dev #macOS #Swift #AppKit nostr:nevent1qqsqnhum35z2897f9p9xteqktxa2se0py9xhqh39ssap8cv756p9t0czyzwflq0d090s7hh62kyn9qjxslvyl3lx5n86dk6ad5a4pl9hl7hvyqcyqqqqqqgpz3mhxue69uhkummnw3ezummcw3ezuer9wcxx28xn
2025-11-01 10:39:04 from 1 relay(s) 1 replies ↓
Login to reply

Replies (1)