I’ve split my recent work into two posts: this one and LILIDE.
PokiPad is a plaintext editor for Pokitto.
It’s a basic program that tries to imitate the simplest text editors you find on most operating systems. However, it should be quite easy to extend and add functionality if you want to shape it to your liking (one example is LILIDE that I’ve made based on this) – just make it whatever you want.
Along with the program I made a few other reusable modules you can make use of. These include an onscreen keyboard along with related text handling and rendering classes (keyboard.hpp), ASCIIfying library and an extension of PokiPad (LILIDE).
The current PokiPad features are:
- Editing long multiline plain ASCII text in a way you’re used to (cursor movement, backspace, delete, …).
- Basic operations you know from text editors: selecting, copying, pasting, searching.
- Advanced onscreen keyboard with all printable ASCII characters, multiple layouts, and hotkeys for “fast and comfortable” typing.
- Opening and saving files from/to SD card.
- Document stats (number of characters, words, …).
And its limitations are:
- You can only have one file open (no tabs).
- You can only edit a file to a maximum size of 10 kB (not KiB), in order to FIT in the RAM. You can open a bigger file, but it will be truncated (you’ll be warned about this).
- You can only open and save files to the root of the SD card, not subfolders.
- There is no undo. It was planned, but I scratched it for the base version as it’s not that easy to implement.
- The program only works with ASCII (7 bit) encoded files. You can open files in some other encodings, such as UTF-8, but it’ll be converted to an ASCII approximation and you may lose information this way.
- The configuration (theme, keyboard layout, …) is currently not saved to EEPROM.
- There are no scrollbars (but there is an infobar telling you the column and row position).
- With a cursor placed on a line that has tabs before the cursor may cause non-optimal view placement (the screen may not align with the cursor correctly). It’s because within the current framework computing the actual cursor position can’t be done quickly because tabs’ width depends on their position, so the cursor position is only estimated.
The controls are as follows (feels quite natural once you get used to it, trust me):
- Use arrows to select a keyboard key.
- A to type the key.
- Navigate to bottom right to open the menu.
- To switch a keyboard page (lowecase/uppercase, …) there is a special key on the keyboard, next to the arrows.
- B + arrows (all four): move cursor
- B + A (swipe right): delete
- B + C (swipe left): backspace
- C + A: switch keyboard page
- C + up: space
- C + down: shift (turn selection mode on/off)
WARNING: back up your SD card if you value the content! The Pokitto SD card library I used is a WIP and has bugs. I may also have bugs in my code. It is therefore not impossible your files will get corrupted and/or lost.
Also: some SD cards may not work with this program. I experienced this with my own card – it’s an issue with the SD library. At the moment you can do nothing but switch to another card.
This program is free software released under CC0 1.0 waiver, which means it is in the public domain and you can do absolutely anything with it (including commercial use) without any burden (including giving me credit). If you like the program and want to thank me, the best way is to share your own software as free and open source as well, using an appropriate license.
Here is the code and the binary:
pokipad.bin (126.8 KB)