lorenzos / ZenCodingNetBeansPlugin

Zen Coding plugin for NetBeans
233 stars 57 forks source link

Undo/Redo handled incorrectly in Netbeans #6

Closed ghost closed 12 years ago

ghost commented 12 years ago

Note: I'm using Netbeans 7.0.

If we issue an 'Undo' after 'Expand Abbreviation' action the original expression plus the expanded tags get deleted. Same with 'Wrap with Abbreviation', 'Undo' would delete the original wrapped string along with the expanded wrapping tags.

In both cases the correct behavior is to undo the expansion action itself and leave the original strings intact. In the case of wrapping it's clear that we would like to keep the original text. In the case of expansion, we would like to go back to the original abbreviation and edit it and reapply expansion.

It seems that the actions of the plugin are replacing the last action in the action history list of the application rather than adding a new action that can be undone separately.

And by the way - thanks a bucket for your work on this plugin.

Regards, Basel Shishani.

lorenzos commented 12 years ago

If I remember well, it doesn't replace the last action in the undo history, but instead it creates a one too many. I mean that a first action is registered with abbreviation "erasing", and another one for the code replacement. So, try to undo two times, and let me now if your abbreviation comes back. Anyway, I know this is not the perfect behaviour, but I was not able to manage the undo history myself in my code. I will try again.

ghost commented 12 years ago

True, two undo steps reverts to the original state. As you said, not perfect but usable. Thanks again.

lorenzos commented 12 years ago

Anyway I'm going to leave this issue opened until I will find a better solution or realize there is not.

shiplu commented 12 years ago

Facing same issue. But pressing Ctrl+Z twice did the trick. Thanks for the info.

lorenzos commented 12 years ago

Thank you Shiplu. In fact, I've already fixed that issue.

I'm just waiting to commit and release the new package because I'm currently adding support for some other actions (number increments and decrements).

lorenzos commented 12 years ago

Solved in commit fe1515d. Updated 0.9 version just released! http://github.com/downloads/lorenzos/ZenCodingNetBeansPlugin/org-lorenzos-zencoding-0.9.nbm