Author Topic: Encapsulate multiple edits in a single Undo transaction?  (Read 2998 times)

Ivan N. Zlatev

  • Community Member
  • Posts: 87
  • Hero Points: 5
Encapsulate multiple edits in a single Undo transaction?
« on: January 22, 2008, 04:15:38 pm »
How can I encapsulate multiple edits (e.g _insert_text) in one undo transaction? Something like

Code: [Select]
undo_transaction_open
_insert_text
_insert_text
undo_transaction_close

so that now I can undo everything betwwn open and close at once.

hs2

  • Senior Community Member
  • Posts: 2738
  • Hero Points: 288
Re: Encapsulate multiple edits in a single Undo transaction?
« Reply #1 on: January 22, 2008, 04:28:10 pm »
Hope I'm right - this should do what you want:
Code: [Select]
   // start a new undo 'level'
   _undo('S');

   // ... transaction

   if ( doUndo )  // undo the transaction
      _undo();
Used this a while ago but unfortunately I've deleted the macro.
HS2

Ivan N. Zlatev

  • Community Member
  • Posts: 87
  • Hero Points: 5
Re: Encapsulate multiple edits in a single Undo transaction?
« Reply #2 on: January 22, 2008, 04:45:11 pm »
Works! thanks.