AnglerFrame

TUI Text Editor
TL;DR: AnglerFrame is a (partial) Swift based port of Antirez’s kilo editor and is intended as a learning experiment into VT100 commands as well as more “system” programming using Swift.

Like I am with programming languages, I’ve also always been facinated by TUI based text editors and when I stumbled across gram, a Zig port of kilo I was hooked and just knew that one day I’d make my own text editor. When I later found this wonderful tutorial from Paige that breaks down building kilo from the groundup, I just had to get started.

AnglerFrame’s top priority is to be a sandbox for learning about topics such as VT100 commands, raw-mode terminals and TUI implementations and syscalls from Swift. I don’t have a ton of experience with any of these, let alone in Swift, so having an established and somewhat guided introduction has already been a wonderful adventure.

Notable differences from kilo:

Technology


Dev Logs

I’ve spent an evening hour or so a day for the last week working on AnglerFrame and following along with the fantastic tutorial for building kilo from the ground up, and have made it about halfway through “Chapter 4” which is the first chapter to really pick up the pace with the “text editor” bits. Up to this point (Chapters 1-3), we’ve been concerned with laying down the groundwork for building a UI using VT100 commands and doing tasks like moving the cursor around the screen and handling interacting with the terminal device in a clean fashion. Chapter 4 concerns itself with making a text viewer and really brings out the quirks in human language as we start to dive into handling displaying text and moving a cursor around it in a meaningful way.

At this point I’ve already implemented a few features that take a departure from the standard kilo, as well as having a fairly different take on the code layout. I’ve gotten UTF-8 displaying without issue thanks to Swift (although I’m sure I’ve got a few length bugs and other issues that’ll surface as I work on “Chapter 5” which implements text-editing) and I’ve made the cursor behave more similar to Vim (more on this below) and I’ve got line numbers in a “gutter.”

AnglerFrame Displaying Markus Kuhn’s UTF-8 plain text demo!

Continue reading