Hi,

  This may be the wrong way to look at things though. Possibly, you
just need a mechanism to break CellBuffer coalescing when you add an
action to your undo stack.  There is currently no explicit call for
this but I think BeginUndoAction(); EndUndoAction() may work.

  Yet another approach would be to expose some form of action ID to
the outside world so that you could save the action ID at the point
you perform an outside action. There are issues with the form of
action ID and its lifetime that would have to be worked through.
it was an idea also. in fact to control scintilla from my stack I must be able to tell that there is in my stack: one action of mine (matching X actions of scintilla but a single Begin/EndUndoAction pair), then N actions of scintilla, then again an action of mine... I think that one problem for me is to be able the N in 'N actions of scintilla' else I cannot have in my stack a one-to-one mapping of scintilla actions with my actions so that clicking 'undo/redo' will actually undo/redo one action of scintilla. The command that I issue by myself can clearly be enclosed with Begin/EndUndoAction.

I realize that one other way would be to have a "StoreExternalAction(ID)" when undo/redo would be called on it, Scintilla would do nothing but send a SC_EXTERNAL_ACTION notification with the ID and the right SC_PERFORMED_???.On this notification, my component would do its job? It would be used just before the Begin/EndUndoAction pair would finish... this way: - at user time the sequence would be: BeginUndoAction, action(s), ExternalAction, EndUndoAction - at undo time: (Scintilla)Undo would undo all the stuff from scintilla, SC_EXTERNAL_ACTION | SC_PERFORMED_UNDO would simply undo non-scintilla part - at redo time: (Scintilla)Redo would redo the stuff from scintilla, and the notification would redo non-scintilla part.

external actions with no impact on scintilla would not need to be enclosed in Begin/EndUndoAction pairs and could be handled as well.

but I'm maybe too fast, I still have a problem because I must react on all the actions of scintilla, not just those that I enclose by myself in Begin/EndUndoAction pairs, so that there is no way to call something like StoreExternalAction. If I lack the event telling me 'I just finished a transaction' or 'I just started a transaction', I do not know the limits of those actions and will not be able to store the undo/redo stuff with the same granularity and then will not be able to undo/redo.

so, so... each time an implicit or explicit BeginUndoAction happens I must get it, so that I can close the previous transaction of high-level and start a new one. I'm going to try to implement the SC_START_ACTION that you proposed and see if it works, it should.

OK I have implemented the SC_START_ACTION it allows me to monitor Scintilla stack correctly from outside. Tomorrow I'll interleave my own actions with those of Scintilla and tell if it works well.


_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest

Reply via email to