SlickEdit Community

Archived Beta Discussions => SlickEdit® Core for Eclipse => Topic started by: yop on June 29, 2008, 08:53:05 PM

Title: Beautifier
Post by: yop on June 29, 2008, 08:53:05 PM
Using the beautifier on C++ I always get the last empty line clipped resulting on compiler warnings. Hoe can I change this behavior?  The beautifier options  don't seem to include something relevant.
Title: Re: Beautifier
Post by: Graeme on June 30, 2008, 11:43:26 AM
Using the beautifier on C++ I always get the last empty line clipped resulting on compiler warnings. Hoe can I change this behavior?  The beautifier options  don't seem to include something relevant.

Record a macro that does
1. Go to bottom of file
2. Go to end of line
3. Press ENTER
4. Select tools -> beautify
5. Save the file (optional)
6. End macro recording and give the macro a name

You'll get a macro that looks like the following.  You can bind a key to it or add it to a menu or just execute from the command line or from macro -> list macros.

Code: [Select]
_command beautify_2() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   _macro('R',1);
   bottom_of_buffer();
   end_line();
   c_enter();
   execute('gui_beautify');
}

Graeme
Title: Re: Beautifier
Post by: yop on June 30, 2008, 04:27:46 PM
After trying it, it has a couple of problems:
* It leaves the caret in the last line of the file.
* The beautifier does not delete the last empty line (probably because the caret is there), so lines just keep getting appended
Title: Re: Beautifier
Post by: Graeme on July 01, 2008, 12:26:47 AM
After trying it, it has a couple of problems:
* It leaves the caret in the last line of the file.
* The beautifier does not delete the last empty line (probably because the caret is there), so lines just keep getting appended

ok, try this.

Code: [Select]
_command void beautify_2() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   _macro('R',1);
   typeless p;
   _str line;
   execute('gui_beautify');
   _save_pos2(p);
   bottom_of_buffer();
   get_line(line);
   if (line != '') {
      end_line();
      c_enter();
   }
   _restore_pos2(p);
}

Graeme