Undo/redo feature requests

SyntaxEditor Brainstorming Forum

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi all, getting to the point now where I'll be looking at undo/redo implementation for SyntaxEditor for WPF. I need to know what you like (or don't like) about the SE4 implementation of undo and what other things you would like to see added.

Please post your ideas. Thanks!


Actipro Software Support

Comments (5)

Posted 16 years ago by Boyd - Sr. Software Developer, Patterson Consulting, LLC
Avatar
Just to have a reference within this thread, the other thread on Documents and Modifications had a discussion about Undo behavior:

http://www.actiprosoftware.com/Support/Forums/ViewForumTopic.aspx?ForumTopicID=3129

I'm not sure if SE4 currently supports this or not, but it would be nice to see the ability to store more descriptive text with each Undo action that can be used. That text can later be used in a GUI to provide the user with details of what type of action will be undone. I think this is something that the developer could hook into via the Document Modified event where a default description will be provided for basic operations and the developer can override with something more appropriate for them. The methods on the Document class used to make modifications (i.e. Insert, Replace) could also be updated to allow the specification of a text to be used for the resulting Undo action.
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Let me summarize the things I have on the list so far...
  1. All basic SE4 undo/redo features.
  2. Restore selection states properly. This may involve persisting either a weak reference to a view or maybe some semi-unique ID (byte value) that cycles when maxed out. The EditPositionRange of the selection before the change was made must be stored.
  3. Navigation points. It seems like "normal" navigation points are stored outside the undo stack. However there is an option in the VS settings "Include insertion point movements in Undo list". For that, when enabled it tracks the caret position in the undo stack. Still this is different that navigation points.
  4. Custom undo names. Can you elaborate on what sort of names you'd like to see here? Right now the logic is that descriptions are based on the modification type (in the new stuff though you can create custom modification types). The only exception is Typing, which will also insert part of the text that was typed into the description. What other sort of customizations do you need here, with examples please.
  5. Cloning the undo history. Some customers wanted to be able to clone a document and its undo history.
  6. Track and restore deleted indicators. A customer requested this. I don't think we should do it explicitly however perhaps having some facility that lets developers store custom data with an undo record (like which indicators will be deleted), would allow them to restore them later.
Let's hear your comments on these things or if you have any additional requests.


Actipro Software Support

Posted 16 years ago by Boyd - Sr. Software Developer, Patterson Consulting, LLC
Avatar
RE: Custom undo names

In general, this is essentially what you already provide with the possible exception that the user can override the default generated description.

For instance, you plan to record a typing action as something like:

Typing 'Actipro Rules!'

The developer may want to change the default description to something like

Typed text 'Actipro Rules!'

Or may remove the text completely. More complex examples might be for the text that is inserted when a code snippet is activated. Not sure what would show up now, but the developer may want to improve the text to include the name of the snippet that was activated.

Custom actions would obviously need the ability to specify a name.

My thoughts were that the name of the undo operation would be somehow exposed in an event where it can potentially be altered.

It sounds like you already have plans to implement was I was referring to. So the key points would be:

1) Allow the developer to override the default undo name given to a standard modification
2) Allow the developer to specify the name given to a custom modification
Posted 16 years ago by Wesner Moise
Avatar
What is the performance overhead of tracking indicators through document modifications?

If I have n indicator, should I see a linear degradation in performance? Logarithmic or other?
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Boyd, right now the design updates do allow for custom text modification types where you can pass it which description to use for that type of modification. This is a new feature that isn't available in SE4. I think that will handle 90+% of people. I have some ideas for handling total per-transaction description customization but I'll keep that a low priority item for now since most people probably won't care.
Wesner, I believe what happens (in SE4 at least) is that it will locate the first indicator that is affected by the modification via binary search. Then it will remove or resize the appropriate indicators. What you would want to do is track which indicators are removed, and store those in custom undo data. Then later on when an undo occurs, read the custom undo data to see which indicators to restore. Of course this assumes that we provide a way for you to read/write custom undo data.


Actipro Software Support