News for hackers. Stuff that matters.
Re:Nerdy internals of an Apple text editor by kccqzy on Tuesday March 05, 2024 @03:08PM (#39608567)
Are the internals of other Mac-native text editors like TextMate similar to this as well?
Re:Nerdy internals of an Apple text editor by Someone on Tuesday March 05, 2024 @03:28PM (#39608777)
Depends on what you call “similar”. They’ll have storage, layout, a part of the layout that’s visible, etc, but they may not separate them that clearly, and won’t have that rich an API. TextView is way more flexible than what the typical _text_ editor needs. Text editors typically don’t need multiple fonts, multiple font sizes, varying line spacing, paragraph indents, proportional fonts, right-aligning or decimal tabs, images inside text, etc.

All those features make TextView relatively slow and memory hungry. Because of that, I don’t think _text_ editors that handle multi-megabyte files will use a single NSAttributedString to store the entire document’s text.

Re:Nerdy internals of an Apple text editor by papereditor on Tuesday March 05, 2024 @05:19PM (#39609890)
Yep. TextView is a beast.

For multi-megabyte files I always use Sublime.

Re:Nerdy internals of an Apple text editor by kccqzy on Tuesday March 05, 2024 @06:31PM (#39610444)
And for multi-gigabyte files I use HexFiend.
Re:Nerdy internals of an Apple text editor by KerrAvon on Tuesday March 05, 2024 @09:29PM (#39611568)
BBEdit is more Mac-like than Sublime and handles multi-gig files with ease.
Re:Nerdy internals of an Apple text editor by papereditor on Wednesday March 06, 2024 @04:29AM (#39614029)
Indeed, there are a handful of those dev-oriented editors that crunch through mega files with ease. No idea why I prefer Sublime. :D
Re:Nerdy internals of an Apple text editor by ladberg on Tuesday March 05, 2024 @03:17PM (#39608696)
A quick glance at https://github.com/textmate/textmate says they don't but someone correct me if I'm wrong
Re:Nerdy internals of an Apple text editor by pvg on Tuesday March 05, 2024 @03:17PM (#39608693)
That depends on the extent on which they rely on the system-provided frameworks. When the needs of the editor get specialized enough, all sorts of hackery happens.
Re:Nerdy internals of an Apple text editor by confd on Tuesday March 05, 2024 @05:02PM (#39609684)
https://github.com/MarkEdit-app/MarkEdit/wiki/Why-MarkEdit

The MarkEdit team uses WebView and have strong opinions about why.

Re:Nerdy internals of an Apple text editor by Ezhik on Wednesday March 06, 2024 @04:46AM (#39614138)
Using CodeMirror in a desktop app seems like an interesting choice. I'd love to hear more about why they took this approach.
Re:Nerdy internals of an Apple text editor by papereditor on Wednesday March 06, 2024 @05:31AM (#39614437)
Web tech is an obvious pragmatic choice. Cross-platform by default, amazing libraries with great support.

The average user does not care.

Re:Nerdy internals of an Apple text editor by sharkjacobs on Tuesday March 05, 2024 @07:49PM (#39610960)
A great example of a very different approach to this is Runestone

https://github.com/simonbs/Runestone