Now, there are just a few more minor details to fix up in the ncurses UI in programming mode. We have to display the contents correctly, allow inserts part-way through, and implement a special behaviour. In programming mode, the GOTO key, when followed by a dot and three numeric digits, caused the calculator to move to that step number instead of inserting a new program step. This is the only context in programming mode in which a keypress is not recorded, but is acted upon, so we’ve added special-case code in the engine to handle it.
We also need a way to exit programming mode. I’ve decided that the exit keypress, CTRL-D, will, in program mode, exit back to run-mode, rather than exiting the calculator entirely. A patch was put in for that.
The current code is checked into the git repository under the tag v2015-01-03.
Here’s a screen shot of the calculator in programming mode. We will be inserting additional lines before the “+” in this program.