Author Topic: Aligning, Slide-In-Prompt, Outdent.  (Read 9672 times)

SlickEdit Support

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 384
  • Hero Points: 29
Aligning, Slide-In-Prompt, Outdent.
« on: April 08, 2010, 08:59:10 PM »
//This macro has been posted for other SlickEdit users to use and explore.
//Depending on the version of SlickEdit that you are running, this macro may or may not load.
//Please note that these macros are NOT supported by SlickEdit and is not responsible for user submitted macros.

"File:       aligneq.e
Author:     Joseph Van Valen
Date:       May 8, 2001
E-mail:     vanvalen@att.com      
VSlick ver. 6.0

Description:

Implements three commands borrowed from other editors.

The first command, align_equals, aligns the equal signs in a group of
selected lines with the right-most first equal sign within the group.

The second command, slide_in_prompt, indents a group of selected lines
(or blocks) by prefixing a user specified string to the first selected
character in each line of the selection. The user is prompted for the
slide_in string.

The third command, slide_out_prompt,outdents a group of selected lines (or
blocks) by removing the user specified string from each line of a
selection.  Lines not containing the specified string are unchanged. The
user is prompted for the slide_out string.

The common thread between each of the commands is that they operate on
selected text and use the selection filter techniques supplied by Visual
Slick.All of these functions expect either a line or block selection to
operate on.  Stream selections are not supported at this time.

To install just execute LoadModule from the Macro menu, specify aligneq.e
click OK.  Next, bind these functions to the keystrokes of your choice.
My preference is to assign align_equals to Alt =>, slide_in_prompt to <Alt
..>, and slide_out_prompt to <Alt ,>.  (I moved complete_prev and
complete_next to <alt [> and <alt ]> respectively).

I hope you find these functions useful."

afflictedd2

  • Guest
Re: Aligning, Slide-In-Prompt, Outdent.
« Reply #1 on: April 23, 2010, 09:10:16 PM »
It works Great!!

sgartner

  • Community Member
  • Posts: 14
  • Hero Points: 2
Re: Aligning, Slide-In-Prompt, Outdent.
« Reply #2 on: July 09, 2010, 10:18:48 PM »
Stream selections are not supported at this time.

Thanks for a useful macro.  To support stream selections, I just added the following instead of your select test:

Code: [Select]
    if (_select_type() == "")
      {
        message("A selection is required for this function");
        return;
      }
    else if (_select_type() != "LINE" && _select_type() != "BLOCK")
      {
        // Convert it into a LINE selection
        _select_type('', 'T', 'LINE');
      }