Live data from Hacker News

Writing my own text editor, and daily-driving it

blog.jsbarretto.com

71–80 of 124 posts

Re: Writing my own text editor, and daily-driving it

#71

Any chance people in this thread have some recommendations for text-editing libraries? I would love to build my own text editor, to do some things in my own way that no one else seems to have an interest in doing, but one of the big things for me is that it must be a GUI. I won't bore people with the reasons, but that requirement forces me to bring along a lot of stuff, like a font renderer (at least one) and a graph…

It's hard to give you a recommendation without knowing the platform details, but if GUI rendering is not the goal, something like raylib might be a great choice to have a cross-platform GUI API, including text rendering.

https://www.raylib.com/

Re: Writing my own text editor, and daily-driving it

#73
post #49

One of the best kept secret and one that he should have tried is "Kate". Good old style editor that is a native app, not an electron app. All the features that you might want and more, but simple and efficient. And the most important for me, super snappy. I can't bear the latency that you get for typing code when using things like vscode. I don't know how people can appreciate that.

Every piece of KDE software I've tried has been buggy to the point that it's now a red flag to me: Spectacle (silently failed to copy/paste), krunner (refused to close), SDDM (refused to login), Dolphin (ffmpegthumbnailer loops lagged out whole system, SMB bugs), System Monitor (wrong information), KWallet (signal fails to open, data loss)

Been using KDE for years and never had any of these problems.

Re: Writing my own text editor, and daily-driving it

#74

Any chance people in this thread have some recommendations for text-editing libraries? I would love to build my own text editor, to do some things in my own way that no one else seems to have an interest in doing, but one of the big things for me is that it must be a GUI. I won't bore people with the reasons, but that requirement forces me to bring along a lot of stuff, like a font renderer (at least one) and a graph…

It's hard to give you a recommendation without knowing the platform details, but if GUI rendering is not the goal, something like raylib might be a great choice to have a cross-platform GUI API, including text rendering. https://www.raylib.com/

Great recc! Unfortunately, raylib doesn't quite go as far as I would need. raylib does all of the text rendering in a very clean way, so I love it for that. But as far as actual editing, it doesn't have anything for that (last I checked, at least). It can render the text in way more ways than I need it to, but it can't actually do the editing work that prevents the common text-editing traps like line-based editing.

It's kind of an odd thing, I think. There are a bunch of articles on how you can write your own AST and use all kinds of data ranges (instead of heap allocation) to do deep technical performance optimization, but very few libraries that actually do any of that which aren't also bundled into an inseparable implementation of the library as a control/editor. Feels like there has been enough ink spilled over the "how" that someone would have packaged it up together into a referenceable library. Yet nothing I can find quite fits.

Re: Writing my own text editor, and daily-driving it

#76
post #49

One of the best kept secret and one that he should have tried is "Kate". Good old style editor that is a native app, not an electron app. All the features that you might want and more, but simple and efficient. And the most important for me, super snappy. I can't bear the latency that you get for typing code when using things like vscode. I don't know how people can appreciate that.

Every piece of KDE software I've tried has been buggy to the point that it's now a red flag to me: Spectacle (silently failed to copy/paste), krunner (refused to close), SDDM (refused to login), Dolphin (ffmpegthumbnailer loops lagged out whole system, SMB bugs), System Monitor (wrong information), KWallet (signal fails to open, data loss)

I have had problems with Spectacle related to permissions on Wayland and I think I experienced the failed to copy bug once.

I have not had any other significant problems for some years - not since KDE4. I do not use SMB but everything else works fine and KDE is my daily driver.

Re: Writing my own text editor, and daily-driving it

#78

I went the same path of writing a text editor from scratch. There are a lot of moving parts, so I tried to outsource as much features as possible - LSP for intellisense, tree-sitter for highlighting and syntax-aware features, fzf for search and file handling, etc. I also tried to design it so that it can be tweaked to one's needs with simple code changes, suckless-style. It was indeed a pain using it for the first fe…

Nice work! And yes, that gradual acceleration of productivity where your fixes and tweaks from the past compound on your ability to get things done in the future is a great feeling.

Re: Writing my own text editor, and daily-driving it

#79

One of the best kept secret and one that he should have tried is "Kate". Good old style editor that is a native app, not an electron app. All the features that you might want and more, but simple and efficient. And the most important for me, super snappy. I can't bear the latency that you get for typing code when using things like vscode. I don't know how people can appreciate that.

Unfortunately there's some thing about their "session management" that makes it unusable for me. I've used it in the past, but apparently differently. (Would have to dig up the specifics)

Re: Writing my own text editor, and daily-driving it

#80
This was so nice to read, I've been trying to encourage my friends to write their own editors, there's something really nice about the process of working within your own tool. I've used my own text editor(it's call Left) for nearly 10 years, it took time to get it just right, but I iterated over the years(using Left to edit Left) but that time I spent putting it together is paid back 20x by the joy it gives me opening it and working in it in the morning.

I'd do it all over again if I had to.

Post reply on HN