Undoable margin indicator

SyntaxEditor for WPF Forum

Posted 8 years ago by James Zheng
Version: 16.1.0632
Avatar

Hi Actipro,

I'm coding to make my margin inidcators undoable. The margin indicators are tagged to text lines and displayed on an indicator margin. When a text line is deleted, the indicator margin is deleted as well. This is already implemented. However, I'm not able to undo it, making the indicator appear again. I'm been looking in the text change options. There is a property named 'Custom Data', which seems to be for this purpose. But there is no way to set it when a text line is deleted, as the text change option is created internally.

May I know how otherwise this could be implemented. Thanks!

Regards,

James Zheng

Comments (8)

Answer - Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi James,

There is nothing built in for tracking indicators that get removed due to edits.  Would you like us to change the ITextChange.CustomData property to have a setter so you can update it?  We don't really use it for anything ourselves.


Actipro Software Support

Posted 8 years ago by James Zheng
Avatar

Hi Actipro,

Making it settable will be great. Could this be in the next maintenance build?

Thanks and regards,

James Zheng

[Modified 8 years ago]

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi James,

Yes we will add a setter for the next maintenance release.


Actipro Software Support

Posted 8 years ago by James Zheng
Avatar

Thank you.

Posted 8 years ago by James Zheng
Avatar

Hi Actipro,

I was debugging through the code and found an issue.

Even if I'm able to set new custom data in document's OnTextChange() call, this custom data in the text change won't be preserved in undo/redo stacks later if the text change is for undo and redo.

Please help ensure that new custom data can be preserved in the undo/redo stack even if the text change happens during undo and redo operations.

Regards,

James Zheng

Answer - Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi James,

You would have to set the custom data in a TextChanging event instead of TextChanged.  The TextChanged event you can consume occurs after the undo record was already created.  As long as you set the custom data in TextChanging, I verified it does persist through the undo/redo stack.


Actipro Software Support

Posted 8 years ago by James Zheng
Avatar

Hi Actipro,

Thanks for the advice. I've changed the flow to what you suggested. It seems more natural to be in the text changing call.

The issue I described above was due to my mistake in my code.

May I know when the next relase will be ready?

Regards,

James Zheng

[Modified 8 years ago]

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi James,

We are still collecting updates for the next maintenance release, so we don't have a date just yet.  Please watch our blog or our Announcements forum to be notified of when the next maintenance release occurs.


Actipro Software Support

The latest build of this product (v24.1.3) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.