Author Topic: Undo confirmation  (Read 5139 times)

asipe

  • Senior Community Member
  • Posts: 113
  • Hero Points: 4
Undo confirmation
« on: November 10, 2006, 02:18:09 am »
Anyone know of a way to turn of the confirmation box that comes up when doing an undo that spans a save of the current buffer?   I'd love to get rid of that confirmation.

Thanks -andy

Graeme

  • Senior Community Member
  • Posts: 2724
  • Hero Points: 337
Re: Undo confirmation
« Reply #1 on: November 15, 2006, 10:51:24 am »
Anyone know of a way to turn of the confirmation box that comes up when doing an undo that spans a save of the current buffer?   I'd love to get rid of that confirmation.

Thanks -andy

In the slick macro file stdcmds.e, comment out the lines that put up the message box - then use the "load module" command on the macro menu.  (type fp past-save on the cmd line to get to it quickly). 
Code: [Select]
static _str past_save(...)
{
   boolean bool;
   if ( undo_past_save ) {
      _str name= name_name(prev_index('','C'));
      if ( arg(1)!='' ) {
         bool=(name=='redo');
      } else {
         bool=(name=='undo' || name=='undo-line' || name=='undo-cursor');
      }
      if ( bool ) {
         flush_keyboard();
         //int result=_message_box(nls("You are about to undo past previous save.\nContinue?"),'',MB_ICONQUESTION|MB_YESNOCANCEL);
         //if ( result!=IDYES) {
           // return(1);
         //}
      }
      undo_past_save=0;
   }
   return(0);

}

When you install a hotfix or upgrade to slickedit, you might have to redo the above hack.
If you want the ability to turn the warning back on when you need, then declare your own def variable
e.g.
int def_warn_on_undo_past_save = 0;

    if (def_warn_on_undo_past_save)
    {
         int result=_message_box(nls("You are about to undo past previous save.\nContinue?"),'',MB_ICONQUESTION|MB_YESNOCANCEL);
         if ( result!=IDYES) {
            return(1);
         }
    }

and use set-var on the cmd line to change your def variable value.

Graeme
« Last Edit: November 15, 2006, 11:47:01 am by Graeme »

asipe

  • Senior Community Member
  • Posts: 113
  • Hero Points: 4
Re: Undo confirmation
« Reply #2 on: November 16, 2006, 07:52:10 pm »
Thanks - that worked perfectly. 

Digging into the source was my next step, you sure made it easy for me ;)

-andy