It has been a spell since I updated this phlog. I am doing so currently in the text editor I forked[0] and built on[1] for colorfield space users to use. We previously had chalk[2], which did the job but left a good amount to be desired for anything more than some quick edits/posting. Working on this editor is the first time I have worked with C code for much more than editing a suckless config.h or the like. It has been interesting. I have no doubt mangled some aspect of memory management, though it mostly seems to do alright. I do not know when strings (char *) need to have a null byte terminating them and when they do not. Sometimes the original editor code did so and sometimes it did not. Meh, I'm working through the issues. I followed a code along[3] for the beginning bits of the editor, typing each line by hand (no copy and paste) and modifying things as I went to suit my purposes. The code along walked through all of the terminal handling (which was largely the same as I did for Bombadillo, but using different apis), the basic editing, and syntax highlighting. My additions were mostly to make the editor a modal editor and add some of the vi key bindings. All of the basic movement keys (h,j,k,l,gg,G,w,e,b) work, as do o and O for opening rows. Moving to a row is accomplished slightly differently. I did not implement any : based commands so everything is just keystrokes. So if a user enters a line number followed by enter while in command mode, the cursor will move to that line. Numbers can also be used a multipliers for some commands (20dw will delete the next twenty words). Delete works as well (dd, dw, de, dg, dG, db). All of those also add the deleted item to the paste buffer. Pasting works...mostly. When doing a command like 20dw, only the last word gets added to the paste buffer. I need to rework the way code gets copied to the buffer in order to get it working better and have the whole sequence available. The main issue is multiline deletes or selections (visual mode is mostly working as well). I have had trouble getting all of the text into the paste buffer. I keep running into unexpected memory overflows and other weird behavior. What I have tried it to take the current position of the cursor and the final position of the cursor and loop through counting characters. I then call realloc the paste buffer to the length needed. I then memcpy the data in. It doesnt seem to work reliably though, so I have some bugs to work through there. For the moment, I have disabled the ability to copy a visual selection that spans more than one row. I also added a bunch of keywords and file extensions to the syntax highlighting. So it will now work with C, Go, Lua, HTML, PHP, and Shell. I will add more as needed. I moved all of the syntax settings into their own header file so anyone that wants to compile my version can add whatever they want there (it is commented to make it easy for someone that doesn't know any C). I also created a config.h file that stores things like tab width, color scheme, etc. So everything should be easily changeable. It has been fun to work on and has been a great learning experience. It is also quite gratifying to be able to type out this phlog on something I typed out myself (I wont say wrote myself since antirez wrote the bulk of it, I just made it usable for my use case). I hope any readers of this phlog are having a good 2020 so far! Mine has been good, though I have been sick for most of it so far. No worries though, I have a lot to be thankful for :) [1] Kilo, by antirez https://github.com/antirez/kilo [2] Hermes, by sloum (my fork of kilo) https://tildegit.org/sloum/hermes [3] Build Your Own Text Editor https://viewsourcecode.org/snaptoken/kilo/