GNOME Bugzilla – Bug 731216
Fix undo/redo after using Clear Board
Last modified: 2014-06-12 09:43:46 UTC
After using Clear Board, the undo stack should be cleared, and Undo and Redo should both be insensitive.
According to this comment - https://bugzilla.gnome.org/show_bug.cgi?id=633464#c138, I agree the better way would be to enable the Undo button once the board is cleared. On clicking, the board should be reset to the state just before clearing. I'm working on a patch for this, what should I follow - make Undo/Redo insensitive on clearing board or enable them for one step ?
I am not sure about this since we would want to disallow re-winning and we have to stop the game clock and stuff. Maybe you can look and make a small writeup of all the stuff we are tracking during a game and which parts allow for an undo after winning and which don't. I think we wouldn't want to congratulate for winning for the same game twice.
I completely misunderstood Sorry. Yeah, we could undo the board clearing. We'd have to track the game as a transaction where we remove the top bit from the stack, rollback to an empty board and replay the whole transaction. Not sure how that would work with the planned snapshots though.
The other way would be that we save full board positions after every interaction and could go back to any of them. Clear board would just be an empty board on the stack.
Created attachment 278249 [details] [review] Fix Undo/Redo on using Clear Board Here's how Undo/Redo will behave after this patch - - If board is empty and Clear Board is clicked, both Undo, Redo will become insensitive (because there isn't any step to go back to). - If board is filled and it's cleared, the filled values will be added to undo stack, and Undo will become sensitive. User will then be able to undo the clear board action and also redo it.
> If board is filled and it's cleared, the filled values will be added to undo stack, and Undo will become sensitive. User will then be able to undo the clear board action and also redo it. But we do lose the history before the board clearing. The patch looks fine but are we alright with that?
I followed the bug's description - "After using Clear Board, the undo stack should be cleared, and Undo and Redo should both be insensitive." what we're doing is just an addition to this - giving the user an option to undo his Clear Board action. So, I think we're in line with the behavior Michael intended.
I think we have to think about that a bit. We reset the board and reset the timer in :68 but we can redo the clearing. Say we had the board almost-finished, having one or two unsolved space, we clear board, undo the clearing, solve -> only a few seconds. I don't have a good idea of how to solve that in an unintrusive way. So maybe we don't want to be able to undo the clearing action, coming back to the original bug, that undo isn't insensitive. Do you have an idea?
Oh, I hadn't thought about the timer. For now, we can just make the Undo/Redo insensitive, and clear the stacks on Clear Board. No option for undoing the action. When we implement the Tracker, we can add a snapshot of the board on Clear. That would allow the user to go back and see where we was wrong.
> For now, we can just make the Undo/Redo insensitive, and clear the stacks on Clear Board. No option for undoing the action. I agree > When we implement the Tracker, we can add a snapshot of the board on Clear. That would allow the user to go back and see where we was wrong. Still in agreement. Since this is not intrusive and, besides the time issue, was looking very good, you can push the fix at your leasure, I think.
Patch updated and pushed as e9220ef