The editor is a terminal based modal word editor with vi-like navigation that provides a lot of facilities to edit and compile Pochi assembly sources. It is not curse-based, it uses VT100 escape sequences, this means that is should work fine on any VT100 terminals (aka most terminals on UNIX).
Note: The UI/UX might feel clunky or even buggy at times, please be mindful that it will need quite some polishing to “feel” good writing Pochi assembly with it. Any suggestions or bug reports are welcome at this point. Nothing is set in stone :)
Since Pochi is based on ColorForth there are two concept on which our custom editor can easily provide more convenient editing than standard text editor:
This way our editor becomes both simpler while providing an enhanced editing experience.
This implies that the “cursor” is always focused on a word. Of course we type the words one character at a time, but you can’t move the cursor inside a word, you can only append or delete the leading character. You can also delete the whole word, change it’s color and such with a single shortcut usually.
Not focusing on characters simplifies the internal representation of the “text” in the editor as well as the pre-parsed nature of Pochi assembly. And surprisingly enough you never really miss the ability to edit individual characters.
Due to the pre-parsed nature of Pochi assembly, an editor that aims to make the source code more readable and pleasant to work with, will have to provide a convenient way to distinguish the different roles of each words. This editor we will initially use colors to primarily distinguish between different roles.
Whenever color becomes a seemingly essential feature, the color blindness affliction becomes a show-stopper for certain people. It is good to remember that color is merely a very convenient way to tag a word visually, an example of tag that doesn’t use color do be distinguishable is the magenta words and the magenta strings.
If you are color blind or want to make the experience more convenient to work with Pochi assembly for people that are color blind, you are more that welcome to make suggestions, propose solutions or even better make another editor. By the way this applies to any type of conditions that would make it less convenient to work with Pochi assembly, like visual impairment, impaired motor functions or the likes. I really wish to make this as accessible as possible without sacrificing too much simplicity.
The colors and their roles are described in the Assembly document, but for the sake of completeness we’ll describe the different colors/roles and how the appear visually in the editor:
| color | visual appearance |
|---|---|
| red | red color |
| green | green color |
| yellow | yellow color |
| gray | white color |
| magenta | magenta color |
| magenta string | magenta color surrounded by double quotes |
| white | dimmed white/gray (can be hidden) |
| blue | blue color (can be hidden) |
By default white words (comments) are shown and blue words (format) are hidden, they can
be shown/hidden by using a specific key (c for comments and f for formatting words).
a enters insert mode after the current worde enters insert mode and edit the current wordi enters insert mode before the current wordo open a newline and enters insert modex cut current word into clipboardy yank (copy) current word into clipboardp paste clipboard beforeP paste clipboard afterbackspace delete previous word (see Troubleshooting)del delete current wordu undoU redoc toggle commentsf toggle blue wordss save fileS save file and assemble a .rom filev verify if assembler succeeds, find previous occurrence of the current word. find next occurrence of the current wordleft/h move to previous wordright/l move to next wordup/k move to previous red worddown/j move to next red wordhome move to beginning of the lineend move to the end of the linespace insert a space (blue .) before the current wordtab insert a tab (blue >) before the current wordenter insert a newline (blue cr) before the current wordesc quit insert mode and enters normal modebackspace delete last chardel delete last charspace enter a new wordtab insert a tab (blue >) and enter a new wordenter insert a newline (blue cr) and enter a new wordctrl+q quit the editorctrl+r change the current word to redctrl+g change the current word to greenctrl+y change the current word to yellowctrl+a change the current word to grayctrl+w change the current word to whitectrl+p change the current word to magentactrl+s change the current word to magenta string