I noticed a while ago that there were multiple things wrong IMO with the undo function in the 31S but I haven't yet gotten around to dealing with it properly, or even figuring out whether or not the behavior matches the official documentation. This is something I'll definitely fix unless someone else does it first.
You may want to try the following patch but be warned, it hasn't yet received much testing.
Code:
diff -ur wp31s_r3756/keys.c wp31s_fix_undo_r3756_20150301/keys.c
--- wp31s_r3756/keys.c 2015-02-07 13:09:33.000000000 -0500
+++ wp31s_fix_undo_r3756_20150301/keys.c 2015-03-01 23:10:38.752104407 -0500
@@ -1964,6 +1964,7 @@
OpCode = 0;
if (c == (OP_NIL | OP_OFF) || !is_bad_cmdline()) {
+ process_cmdline();
xcopy(&Undo2State, &UndoState, sizeof(TPersistentRam));
xcopy(&UndoState, &PersistentRam, sizeof(TPersistentRam));
xeq(c);
@@ -2028,19 +2029,27 @@
break;
case STATE_UNDO:
- xcopy(&PersistentRam, &UndoState, sizeof(TPersistentRam));
+ if (CmdLineLength)
+ CmdLineLength = CmdLineEex = CmdLineDot = 0;
+ else {
+ xcopy(&PersistentRam, &UndoState, sizeof(TPersistentRam));
+// xcopy(&UndoState, &Undo2State, sizeof(TPersistentRam));
+ }
break;
default:
if (c >= (OP_SPEC | OP_ENTER) && c <= (OP_SPEC | OP_F)) {
if (c != (OP_SPEC | OP_ENTER) || !is_bad_cmdline()) {
// Data entry key
- xcopy(&Undo2State, &UndoState, sizeof(TPersistentRam));
- xcopy(&UndoState, &PersistentRam, sizeof(TPersistentRam));
+ cmdline_empty = (CmdLineLength == 0);
+ if (c == (OP_SPEC | OP_ENTER) || (CmdLineLength == 0 && c == (OP_SPEC | OP_CLX))) {
+ process_cmdline();
+ xcopy(&Undo2State, &UndoState, sizeof(TPersistentRam));
+ xcopy(&UndoState, &PersistentRam, sizeof(TPersistentRam));
+ }
#ifndef CONSOLE
WasDataEntry = 1;
#endif
- cmdline_empty = (CmdLineLength == 0);
xeq(c);
cmdline_empty |= (CmdLineLength == 0);
}