Dogo is a handmade text editor written in C. Although not finished, it has many features that I want to showcase. Here is a short video demonstration with narration:
tl;dr Features: Written from scratch in c89 standard. Handles files GBs in size. Very cross platform; UNIX-like, TUI, CLI, maybe Windows and more. Custom CPU renderer with 10 bitmap monospace fonts. Lightweight, very small latency when typing. UTF-8 support up to 0xffff code point, no emojis. Execute shell commands. Navigate directories. Jump to files by absolute and relative paths. Select, copy, cut, paste, integrated with OS clipboard. Search, find and replace, jump to line, autoindent. Line wrap, cursor navigation on visual lines. Inspect whitespaces with selection. Config file, rulers, custom color themes and shortcuts. Multi file editing, detects change in file outside of editor. Keyboard oriented. Work in progress: Asynchronous shell commands execution. Editing history. Column and line numbers. Syntax highlighting for more than git diff. Make it open source. LSP support. Mouse support, maybe? And more... Demonstration video transcript This is a demonstration of text editor named Dogo. I'm showing different font sizes and colors themes, the column indicator and backdrop ASCII art. Editor supports UTF-8 encoding and visual line wrapping. You can see basic operations like opening files, editing, saving, selection, copy, cut and paste. Note that selection revels white characters, dot for space, tab as arrow and new lines as empty character cell. Top bar show absolute path to open file or directory. By editing this path we can open files, search for text, do find and replace and execute shell commands. It also prints messages like "File does not exist". Main feature is ability to edit text files GBs in size. In fact you can edit files as big as your free memory. This works because editor parses only lines that are visible on the screen at given time. All other functionalities are designed to work with that limitation. I'm now free to edit big SQL database dumps, log files, giant JSONs ant others. You can see me executing shell commands. Although it's not a terminal it does work well with CLI shell programs. By visiting a directory you are presented with empty file that can't be saved on disc. But it's used as shell session where first "ls" command runs to give an you overview of directory files. You can jump to a file by simply pressing Ctrl+Enter when text cursor is on relative or absolute file path. File path might also include line number or search phrase. This works great with shell commands output like: ls, grep, find, compiler errors, git status, git diff but also the import or include paths in your code and any other file path that you see on the screen. It makes navigation between project files vert smooth and fast. Many files can be open at the same time. Sometimes you see me displaying list of currently open files. From there you can jump to any of those using the same jump command as explained before. What you can't see is the latency, so called input lag. To be precise, I can't demonstrate on video how responsive the editor is. You might think that other text editors give instant feedback but in fact they are far from it. Dogo text editor will make you think that you have a better keyboard, because speed is the feature that I care about. The pixelated font style is not a stylistic choice but a result of design decisions. I implemented a custom CPU bitmap font renderer. There are only 10 different fonts available. And the only difference between them is the resolution of glyphs. This gives 5 different font sizes in 2 variants: regular and bold. You saw me switching fonts at the beginning. This limitation is a direct result of decision to write Dogo from scratch in C 89 standard without dependencies and making porting to different platforms easy. With bitmap font renderer it's easier to target platforms that don't have a GPU and it's easier to have cross platform code in general. Speaking of platform, the editor works on POSIX platforms with x11 display servers, which covers most Linux distributions and BSD. There is also SLD port making editor run on MacOS. It was once compiled on Windows but I'm not really concerned with Microsoft software. The portability goes much further with possibility to compile Dogo as non graphical software. For example as TUI program but also an CLI program. Modality of code empowers possibilities to interchange logic of how text is displayed and how commands are executed. It's not mandatory to use an Keyboard as input device or pixels as output representation. Editor core is what matters. This makes it very cross platform. It's important to point out, that Dogo purposefully do not implement window management functionalities like tabs or splitting window horizontally or vertically. Most programs today tries to take over the whole screen. I will not contribute to that idea. Crucial parts of the code are covered by unit tests written in my unit tests library called Walter. That includes libraries for gap buffer data structure, UTF-8 encoder/decoder and string manipulations. Those are critical to ensure that text file data is correctly parsed, presented, modified and saved without corruptions. Although Dogo is not production ready it already proven to be an great companion for programmer. For months I used it to work on editor code from within the editor. There is much more to it than shown in this demonstration, but my programming can no wait. I fear that my long delay may have already had a catastrophic impact on the source code. End of line. Screenshots No mouse I added basic mouse support at some point because it's actually very easy to implement. But commit was reverted the same day because I didn't liked it. Maybe later I will add it back. But for now GUI version of editor supports only keyboard input. And yes, the initial commit was made at 4 am. $ git log --grep=mouse commit e859043a8803fe480990bb9f08bc8b7e76700a64 Author: irek <irek@gabr.pl> Date: Tue May 21 20:19:52 2024 +0200 Revert "Set cursor position by mouse click" Yea, I don't like it already. Just when I click on the window to get it into focus I'm changing cursor position. I don't like that. It might sound cool but it's a bad idea to have it, at least at the moment. No mouse! [0] [0] https://youtu.be/1z_GF0KAAkg This reverts commit 49928b69744ddea9375d9817e49f08947f9f2ceb. commit 49928b69744ddea9375d9817e49f08947f9f2ceb Author: irek <irek@gabr.pl> Date: Tue May 21 04:10:42 2024 +0200 Set cursor position by mouse click Just because it was super easy to add. Afterwords Working on this software feels more like a research project. Searching for best data structures for my requirements, learning about text encoding and Unicode. I read many source files of other projects, mainly text editors but also terminals and X11 graphical applications. I changed code architecture few times in effort to have best portability with least effort. Last year I dropped work on Dogo for few months due to my inability to go further with harder parts of code. I spent time reading books about C and programming in general, watching coding videos. I finally got back to it this year with new confidence. Editor sill lack features necessary to replace my Emacs workflow used for day job. But the ending has not yet been written. Post written in Dogo wow wow, I'm so proud of my good boy (^-^ ) Written: 2024-10-13
Features:
Work in progress:
This is a demonstration of text editor named Dogo.
I'm showing different font sizes and colors themes, the column indicator and backdrop ASCII art. Editor supports UTF-8 encoding and visual line wrapping. You can see basic operations like opening files, editing, saving, selection, copy, cut and paste. Note that selection revels white characters, dot for space, tab as arrow and new lines as empty character cell. Top bar show absolute path to open file or directory. By editing this path we can open files, search for text, do find and replace and execute shell commands. It also prints messages like "File does not exist".
Main feature is ability to edit text files GBs in size. In fact you can edit files as big as your free memory. This works because editor parses only lines that are visible on the screen at given time. All other functionalities are designed to work with that limitation. I'm now free to edit big SQL database dumps, log files, giant JSONs ant others.
You can see me executing shell commands. Although it's not a terminal it does work well with CLI shell programs. By visiting a directory you are presented with empty file that can't be saved on disc. But it's used as shell session where first "ls" command runs to give an you overview of directory files. You can jump to a file by simply pressing Ctrl+Enter when text cursor is on relative or absolute file path. File path might also include line number or search phrase. This works great with shell commands output like: ls, grep, find, compiler errors, git status, git diff but also the import or include paths in your code and any other file path that you see on the screen. It makes navigation between project files vert smooth and fast.
Many files can be open at the same time. Sometimes you see me displaying list of currently open files. From there you can jump to any of those using the same jump command as explained before.
What you can't see is the latency, so called input lag. To be precise, I can't demonstrate on video how responsive the editor is. You might think that other text editors give instant feedback but in fact they are far from it. Dogo text editor will make you think that you have a better keyboard, because speed is the feature that I care about.
The pixelated font style is not a stylistic choice but a result of design decisions. I implemented a custom CPU bitmap font renderer. There are only 10 different fonts available. And the only difference between them is the resolution of glyphs. This gives 5 different font sizes in 2 variants: regular and bold. You saw me switching fonts at the beginning. This limitation is a direct result of decision to write Dogo from scratch in C 89 standard without dependencies and making porting to different platforms easy. With bitmap font renderer it's easier to target platforms that don't have a GPU and it's easier to have cross platform code in general.
Speaking of platform, the editor works on POSIX platforms with x11 display servers, which covers most Linux distributions and BSD. There is also SLD port making editor run on MacOS. It was once compiled on Windows but I'm not really concerned with Microsoft software. The portability goes much further with possibility to compile Dogo as non graphical software. For example as TUI program but also an CLI program. Modality of code empowers possibilities to interchange logic of how text is displayed and how commands are executed. It's not mandatory to use an Keyboard as input device or pixels as output representation. Editor core is what matters. This makes it very cross platform.
It's important to point out, that Dogo purposefully do not implement window management functionalities like tabs or splitting window horizontally or vertically. Most programs today tries to take over the whole screen. I will not contribute to that idea.
Crucial parts of the code are covered by unit tests written in my unit tests library called Walter. That includes libraries for gap buffer data structure, UTF-8 encoder/decoder and string manipulations. Those are critical to ensure that text file data is correctly parsed, presented, modified and saved without corruptions.
Although Dogo is not production ready it already proven to be an great companion for programmer. For months I used it to work on editor code from within the editor.
There is much more to it than shown in this demonstration, but my programming can no wait. I fear that my long delay may have already had a catastrophic impact on the source code. End of line.
I added basic mouse support at some point because it's actually very easy to implement. But commit was reverted the same day because I didn't liked it. Maybe later I will add it back. But for now GUI version of editor supports only keyboard input. And yes, the initial commit was made at 4 am.
$ git log --grep=mouse commit e859043a8803fe480990bb9f08bc8b7e76700a64 Author: irek <irek@gabr.pl> Date: Tue May 21 20:19:52 2024 +0200 Revert "Set cursor position by mouse click" Yea, I don't like it already. Just when I click on the window to get it into focus I'm changing cursor position. I don't like that. It might sound cool but it's a bad idea to have it, at least at the moment. No mouse! [0] [0] https://youtu.be/1z_GF0KAAkg This reverts commit 49928b69744ddea9375d9817e49f08947f9f2ceb. commit 49928b69744ddea9375d9817e49f08947f9f2ceb Author: irek <irek@gabr.pl> Date: Tue May 21 04:10:42 2024 +0200 Set cursor position by mouse click Just because it was super easy to add.
Working on this software feels more like a research project. Searching for best data structures for my requirements, learning about text encoding and Unicode. I read many source files of other projects, mainly text editors but also terminals and X11 graphical applications. I changed code architecture few times in effort to have best portability with least effort.
Last year I dropped work on Dogo for few months due to my inability to go further with harder parts of code. I spent time reading books about C and programming in general, watching coding videos. I finally got back to it this year with new confidence.
Editor sill lack features necessary to replace my Emacs workflow used for day job. But the ending has not yet been written.
Post written in Dogo wow wow, I'm so proud of my good boy (^-^ )
Written: 2024-10-13