After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 731216 - Fix undo/redo after using Clear Board
Fix undo/redo after using Clear Board
Status: RESOLVED FIXED
Product: gnome-sudoku
Classification: Applications
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gnome-sudoku-maint
gnome-sudoku-maint
Depends on:
Blocks:
 
 
Reported: 2014-06-04 14:46 UTC by Michael Catanzaro
Modified: 2014-06-12 09:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix Undo/Redo on using Clear Board (1.77 KB, patch)
2014-06-11 06:43 UTC, Parin Porecha
none Details | Review

Description Michael Catanzaro 2014-06-04 14:46:30 UTC
After using Clear Board, the undo stack should be cleared, and Undo and Redo should both be insensitive.
Comment 1 Parin Porecha 2014-06-10 12:07:51 UTC
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 ?
Comment 2 Mario Wenzel 2014-06-10 14:00:42 UTC
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.
Comment 3 Mario Wenzel 2014-06-10 14:04:07 UTC
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.
Comment 4 Mario Wenzel 2014-06-10 14:08:44 UTC
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.
Comment 5 Parin Porecha 2014-06-11 06:43:28 UTC
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.
Comment 6 Mario Wenzel 2014-06-11 13:28:15 UTC
> 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?
Comment 7 Parin Porecha 2014-06-11 14:12:02 UTC
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.
Comment 8 Mario Wenzel 2014-06-11 14:39:38 UTC
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?
Comment 9 Parin Porecha 2014-06-11 16:19:47 UTC
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.
Comment 10 Mario Wenzel 2014-06-11 16:58:35 UTC
> 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.
Comment 11 Parin Porecha 2014-06-12 09:43:46 UTC
Patch updated and pushed as e9220ef