Author Topic: Hungry Delete Macro bound to backspace key  (Read 2237 times)

Anaconda55

  • Junior Community Member
  • Posts: 2
  • Hero Points: 0
Hungry Delete Macro bound to backspace key
« on: July 08, 2013, 12:27:47 pm »
Hi. I have bound the backspace key to the macro of this topic: http://community.slickedit.com/index.php?topic=3819.0
The macro works, but in a dialog, like the search/find dialog I can't delete characters with the backspace key.
Do you know why I can't use the backspace key in a dialog when I have bound the key to the hungry_delete or another command?
Can anyone reproduce this problem?

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1125
  • Hero Points: 105
Re: Hungry Delete Macro bound to backspace key
« Reply #1 on: July 08, 2013, 01:35:44 pm »
Give this a try, I had to add the "VSARG2_TEXT_BOX" to the command declaration, and put in a "command_state()" guard so it doesn't use any properties unsupported by text boxes in dialogs:

Code: [Select]
_command void hungry_delete( ) name_info(','VSARG2_REQUIRES_EDITORCTL|VSARG2_TEXT_BOX)
{
   if (command_state()) {
      linewrap_rubout();
   } else {
      int col = p_col;
      left();
      cur_char = get_text();
      if( col > 1 ) { right();}

      if( is_whitespace( cur_char) )
      {
         /* backspace until we find a char */
         while( is_whitespace( cur_char ) || (col == 1) )
         {
            linewrap_rubout();
            col = p_col;
            left();
            cur_char = get_text();
            if( col > 1) { right(); }
         }
      }
      else
         linewrap_rubout();
   }
}
[code]

Anaconda55

  • Junior Community Member
  • Posts: 2
  • Hero Points: 0
Re: Hungry Delete Macro bound to backspace key
« Reply #2 on: July 08, 2013, 01:45:14 pm »
Nice, now it works! Thank you very much!