Cancelling Undo or Redo command is not honored

SyntaxEditor for Windows Forms Forum

Posted 17 years ago by GI Skier
Version: 4.0.0272
Avatar
I start an Undo or redo action programmatically. During Document.PreTextChanging event I find that in certain cases I need to reject the undo. I set e.Cancel to true for these cases. Even doing so, the editor change will take place.

Is there something special that needs to be done when the change is an undo or redo? Cancelling all other type of text changes (copy, paste or typed text) seem to work fine.

Thanks.

Comments (2)

Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Undo/redo operations are forced through and don't pay attention to the cancel in PreTextChanging.

I believe the reason is that in cases where there are multiple grouped transactions of undo and you undo the group, canceling one of them would corrupt the undo tracking. So therefore, it is not allowed to cancel them.


Actipro Software Support

Posted 17 years ago by GI Skier
Avatar
I understand the logic behind it, but the overall result is bad. It means PreTextChanging does not have full control over what will happen, unless undo/redo is disabled, which is bad too. I hope you find a way to improve this in the future (When one of the multiple grouped transactions is cancelled, the rest of the transactions from there on are cancelled to. This would avoid damaging the integrity of the undo/redo stack, and would give a much logic and better feature experience).
The latest build of this product (v24.1.1) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.