Kein-Hong Man:

> Bracket with the following (barely tested):
>
>    editor.UndoCollection = false
>    -- edit stuff here
>    editor.UndoCollection = true

   No. Turning undo collection off and on breaks the undo collection
sequence so you are no longer able to undo correctly back past that
position. Try running this macro to add "abc" to the editing buffer:

function UndoMess()
    editor:AddText("a")
    editor.UndoCollection = false
    editor:AddText("b")
    editor.UndoCollection = true
    editor:AddText("c")
end

   Press Undo once: "c" disappears. Press Undo again and "b" rather
than "a" is left.

   The correct thing to call is editor:BeginUndoAction() before the
compound action and editor:EndUndoAction() after. UndoCollection
should only be touched if you want to delete all of the undo
information collected before that point (with EmptyUndoBuffer) which
is normally only when loading a file.

   Neil

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

Reply via email to