Up / Down buttons
I started working a few days ago on a new feature for the terminal. Up and down buttons for cycling through history in the REPL. I found myself wanting this while playing around with the application. The board handles the bulk of the work to achieve this as long as we send it the character codes for up and down. However it did take a bit of tinkering to get terminal client behaving properly when sent ANSI codes like:
I've never implemented a terminal client before so this was new territory for me. I've got it to a point where it's working pretty well I think tonight so I made a new release with the new buttons. The biggest challenge with this proved to be alling the historical command to be edited. Since the REPL stores internally the current command as you are cycling through we need to let it know if the user edits the command before sending it. I tried using some other ANSI codes to solve this problem, but had no luck that way. I'm not sure if I have a full enough grasp on those yet. To get it working it will silently send backspaces to erase the internally stored command prompt, but still allow the user to edit it in the edit text. Once the user presses send the prompt is empty and the newly edited (or not) command is sent.
Newline error in the editor
After the new release was ready and uploaded I was playing around a bit more testing out a few new boards (more on that later). I noticed that the code editor was broken when trying to add newlines to the code file. The newlines were not getting written properly, which caused code.py to get malformed.
The fix was relatively quick to get working and I believe all is well now. Hopefully this didn't bite anyone else before it was fixed.
The newest build including both the up/down buttons and the newline editor fix is live now on the Play Store, and a new debug apk has been checked in to the repo.
Additional boards tested (Itsybitsy M4, Feather M4)
As noted elsewhere in the project it should work for all CircuitPython boards, but all of the testing and development was done on a Circuit Playground Express. I finally opened up some of the new M4 boards that have been awaiting testing. Happy to report no issues found so far on the ItsyBitsy or the Feather. You do of course need to edit your boot.py to mount the storage if you want to use the code editor, and neither of these boards has an on board switch so it's not quite as convenient as the CPX. The Feather has a bit of proto board that would fit a small switch nicely though if you wanted. If you're using a board with no hardware switch one thing I've found helpful is creating a REPL macro to rename the boot.py file to boot.py.bak so it won't run, and therefore the storage will remain ready for standard USB file transfer.
If you know of other boards that are for sure working (or not) please drop a comment to let us know.
That's it for this update. Enjoy that sweet REPL history. I'm very sorry if I wrecked your code.py file with newlines.