It uses Scintilla. In fact, at its core, it’s basically just a wrapper around the Scintilla message passing API. There’s a Lua script that parses the Scintilla header files to create the Lua tables that interface with the Scintilla library.
I've looked into TextAdept a few times. It appeals to me because it's got a standard Qt UI, is fast and lightweight and highly customizable with Lua. But I could never commit the time to fully customize it for daily use. Anyway, I'm committed to emacs. Other Scintilla-based editors with a similar feel (but missing the Lua angle) are Geany and Kate.
I downloaded it recently and found it to be quite useful for quick notes. And I can attest to its "fast" claim, using it on a heavily monitored corporate computer, with CrowStrike and what-not; curiously, and I may being hyperbolic here, but, I got the feeling that it was opening faster than MS Notepad, even with Copilot disabled.
The only thing missing is for me is the "save temporary file" behavior, as I have this habit of making a quick note, close to save up space, both in RAM and view, then later on, fire it up again. Will see if there's a Lua api for this later.
Glad to see this hit the front page again! I’ve been making some contributions lately and it introduced me to Lua. At its core it’s basically a very thin wrapper around the Scintilla editing component used by many open source editors. I’ve been working on getting some lower level APIs added for more control over the UI.
Mitchell is to be commended for maintaining the editor solo for so many years and keeping the LOC count really low (2000 lines of C, 4000 lines of Lua). If you’re willing to read the source it’s really easy to wrap your head around the whole thing, which can’t be said for Emacs or Vim. When I find the time I’ll finish my vi mode…
For starters, Sublime Text is closed-source. A better parallel would be something like Neovim, which also is extensible with Lua. What draws me to Textadept over Neovim is that it's intentionally kept very small, which means it's very easy to understand and extend. Contrast with Vim and its massive manual. However, like Emacs, almost everything is fair game for customization. For example, I wanted minimap functionality, so I implemented it:
Textadept's biggest strength is also its biggest weakness: Scintilla allows for a lot of features that are nigh-impossible in the likes of Vim and Emacs due to their reliance on terminal behavior. However, Scintilla is not terribly well optimized and does not support GPU rendering, meaning that while there is very little bloat, Textadept can still chug in some edge cases. The most notable instance right now is large files with no line breaks (e.g. minified js libraries). Other Scintilla-based editors also suffer from this to varying degrees, although Notepad++ has some performance optimizations that seem to mostly mitigate it. Notepad++ is also Windows only and not as easily extensible.
This is a great project! Is there a place to look up the list of inbuilt lexers to understand the editor language support? Will forward to my (more hands-on devs) team members.
Lexing is handled by one of Mitchell's other projects, Scintillua. You'll find the source for all the built-in lexers in there. https://github.com/orbitalquark/scintillua
The documentation for Scintillua also gets pulled into Textadept's API documentation as a dependency, so the syntax is also explained there. It's basically a bridge between Scintilla's native lexing and LPeg.
I developed some plugins for Textadept some time ago. It's very lightweight and mature, but its dependence on different backends on different platforms introduced some frictions (QT vs. GTK etc.). We had a working Mermaid and image viewer plugin. It's really extensible. Never upstreamed them though.
It uses Lua LPEG lexers, which are extremely easy way to de develop syntax parsers/LSPs for new or unsupported languages.
Eventually our project moved to Pragtical, which has SDL as a cross-platform backend and uses the more modern meson as the build system, which made developing for it much easier.
Shameless plug: For anyone interested in new code editors, I'm working on a multi-platform one called ecode [1]. It's similar in spirit to Notepad++ and Textadept, and some of the newer ones like Zed. It tries to be a fresh take using modern tools like LSP and DAP. I started it after using Geany for many years but finding it lacking some essential features for my needs. Speed is a big focus and it has very fast startup time.
27 comments
[ 2.6 ms ] story [ 47.8 ms ] threadI don’t see it mentioned.
Ok, well now I have to find out what hapoens if I get enough splits to make the width of each less than a pixel.
/s
/s
TextAdept - https://news.ycombinator.com/item?id=39571814 - March 2024 (31 comments)
[1] https://github.com/lite-xl/lite-xl
[2] https://lite-xl.com/
The only thing missing is for me is the "save temporary file" behavior, as I have this habit of making a quick note, close to save up space, both in RAM and view, then later on, fire it up again. Will see if there's a Lua api for this later.
Mitchell is to be commended for maintaining the editor solo for so many years and keeping the LOC count really low (2000 lines of C, 4000 lines of Lua). If you’re willing to read the source it’s really easy to wrap your head around the whole thing, which can’t be said for Emacs or Vim. When I find the time I’ll finish my vi mode…
https://github.com/Fwirt/textadept-minimap
Textadept's biggest strength is also its biggest weakness: Scintilla allows for a lot of features that are nigh-impossible in the likes of Vim and Emacs due to their reliance on terminal behavior. However, Scintilla is not terribly well optimized and does not support GPU rendering, meaning that while there is very little bloat, Textadept can still chug in some edge cases. The most notable instance right now is large files with no line breaks (e.g. minified js libraries). Other Scintilla-based editors also suffer from this to varying degrees, although Notepad++ has some performance optimizations that seem to mostly mitigate it. Notepad++ is also Windows only and not as easily extensible.
- Configurable key bindings, including language-specific keys, key chains, and key modes.
Does this include being able to make it feel like vi/vim?
The documentation for Scintillua also gets pulled into Textadept's API documentation as a dependency, so the syntax is also explained there. It's basically a bridge between Scintilla's native lexing and LPeg.
It uses Lua LPEG lexers, which are extremely easy way to de develop syntax parsers/LSPs for new or unsupported languages.
Eventually our project moved to Pragtical, which has SDL as a cross-platform backend and uses the more modern meson as the build system, which made developing for it much easier.
[1] https://github.com/SpartanJ/ecode/