treesheets
treesheets copied to clipboard
Escape key undo behaviour
TreeSheets Version: Apr 29 2018 OS: Windows 8.1
So I recently started using TreeSheets. I started following the tutorial and was on step (3)
, where it mentioned that you can press Escape to exit a cell. In Excel and LibreOffice Calc, pressing Escape mid-edit will undo all of my changes that I've currently done in that editing session, and I did wonder if the same would happen here. Alternatively, I wondered if it would simply leave the cell with my changes intact (the tutorial implies this latter outcome because it lists pressing Escape with pressing Enter or selecting another cell and describes no additional behaviours).
Anyway, what actually happens seems a little odd to me, and having played around with it, I believe it's because when you press Escape, it performs a single Undo operation.
The scenarios NOTE: Changes made to a cell are only undone back to the state a cell was in following either a different cell being edited or when the document was first loaded. The changes that are undone include changes that were made in all previous editing sessions for the cell back to that point.
- Aside from undoing general changes, pressing Escape will also remove the last word in the cell if:
- it was the last word entered
- there is no trailing white-space OR if the caret is anywhere within the text (but not at the very end of the cell's text with trailing whitespace).
- Pressing escape will also undo ALL the word changes made in the current editing session if the last word entered was NOT at the end of the cell's text. This piece of behaviour is probably the closest to what happens in Excel/Calc.
This behaviour seems to match what happens if you press Undo whilst editing a cell, with one exception: If there is a trailing space in the cell and you press Escape whilst the caret is at the end of the text in the cell, it does not remove the word at the end. Whilst the cell is in Edit mode, pressing Undo does.
Replication examples
Example 1 (using tutorial.cts):
- Double-click on the empty cell below step 2.
- Enter the text 'test'.
- Press Enter (or click away from the cell or press F2).
- Double-click on that formerly empty cell that now contains the text 'test'.
- Press Escape. Expected outcome: The text 'test' remains. Actual outcome: The addition of the text 'test' is undone.
Example 2 (using tutorial.cts):
- Double-click on the empty cell below step 2.
- Enter the text 'test ' (note the trailing space).
- Press Enter (or click away from the cell or press F2).
- Double-click on that formerly empty cell that now contains the text 'test '.
- Press Escape.
- At this point, the text 'test ' should still remain.
- Double-click on that cell again.
- Click so that the caret either directly follows 'test' (prior to the trailing space) or is in the middle of the text.
- Press Escape. Expected outcome: The text 'test ' remains. Actual outcome: The addition of the text 'test ' is undone.
Example 3 (using tutorial.cts):
- Double-click on the step 2 cell.
- Enter the text 'test1 test2 test3' at the end of the cell.
- Press Escape. Expected outcome: All edit changes to be undone Actual outcome: Only the text 'test3' in the cell is removed.
Example 4 (using tutorial.cts):
- Double-click on the step 2 cell.
- Enter the text 'test1 test2 test3' at the end of the cell.
- Press Enter (or click away from the cell or press F2).
- Double-click on the step 2 cell.
- Press escape. Expected outcome: No changes should be undone. Actual outcome: The text 'test3' in the cell is removed.
If any of this is unclear I can try and add more information as needed.
Yes, this is indeed a bit wonky. Like you say, it is implemented using the regular undo, and undo does merging of multiple characters into a single undo action, in an effort to make undos both quicker and more memory efficient.
Probably the first thing that should be done is to make Esc NOT do an undo if the cell has been left, which should fix most of these case. It would not fix case 3. That one could be fixed by undoing all undo points that are in the same cell.