You are here: PSPad forum > English discussion forum > Re: can PSPad multiply (or divide) the indent number for all lines at once ?

Re: can PSPad multiply (or divide) the indent number for all lines at once ?

#1 can PSPad multiply (or divide) the indent number for all lines at once ?

Posted by: secarica | Date: 2014-05-01 16:26 | IP: IP Logged

I mean if there is a way to do this on the whole text:

aaaa
  bbbb
    cccc

to become

aaaa
    bbbb
        cccc

(or the reverse)

Edited 1 time(s). Last edit at 2014-05-01 16:27 by secarica.

Options: Reply | Quote | Up ^


#2 Re: can PSPad multiply (or divide) the indent number for all lines at once ?

Posted by: pspad | Date: 2014-05-01 20:29 | IP: IP Logged

Hello
Just now PSPad doesn't have such possibility
You can extend PSpad fuunctionality with own script in any language supported by Windows Scripting Host. Read the help or readme file in the .\Script subfolder

Options: Reply | Quote | Up ^


#3 Re: can PSPad multiply (or divide) the indent number for all lines at once ?

Posted by: Stefan | Date: 2014-05-02 17:28 | IP: IP Logged

You can simply search for the block of spaces or the tabs
and replace that by the double amount?

For example:

Text Text Text
....Text Text
....Text
........Text

Search 4 spaces and replace by 8 spaces:

Text Text Text
........Text Text
........Text
................Text

.

Options: Reply | Quote | Up ^


#4 Re: can PSPad multiply (or divide) the indent number for all lines at once ?

Posted by: secarica | Date: 2014-05-03 07:34 | IP: IP Logged

Myes, I can give a try, only that this way everything containing n spaces will be affected, not only the start of lines (that is some inline comments, position of comments at the end of line code, maybe other things too).

But thanks for the idea, that could be a starting point (right now I need to expand a code from 2/4/6/etc. leading spaces per line to 4/8/12/etc. spaces).

Cristi

Options: Reply | Quote | Up ^


#5 Re: can PSPad multiply (or divide) the indent number for all lines at once ?

Posted by: vbr | Date: 2014-05-03 14:48 | IP: IP Logged

secarica:
Myes, I can give a try, only that this way everything containing n spaces will be affected, not only the start of lines (that is some inline comments, position of comments at the end of line code, maybe other things too).

But thanks for the idea, that could be a starting point (right now I need to expand a code from 2/4/6/etc. leading spaces per line to 4/8/12/etc. spaces).

Cristi

Hi,
for expanding the indentation spaces, you can use regular expression replacement; I believe, something like this might work:

>> Search for >>>
^( +)([^ ])
>>> replace with >>>
$1$1$2

[x] Regular expressions

i.e. all spaces from the beginning of the line up to the first non-space character are replaced with the doubled amount of spaces and the original following character.

Make sure to test it acording to your needs and code befor applying to to you codebase.

The opposite conversion to reduce the indentation cannot be done using a single regex in PSPad (as far as I know).
You could use the same method to anchor for the beginning of the line and the first non-space character, but you must enter the needed amounts of spaces manually step by step.

hth,
vbr

Options: Reply | Quote | Up ^


#6 Re: can PSPad multiply (or divide) the indent number for all lines at once ?

Posted by: myf | Date: 2014-05-03 22:11 | IP: IP Logged

If you need to change indentation of some code you may use this simple utility I made a long time ago for this purpose.

Options: Reply | Quote | Up ^


#7 Re: can PSPad multiply (or divide) the indent number for all lines at once ?

Posted by: secarica | Date: 2014-05-14 11:16 | IP: IP Logged

myf:
If you need to change indentation of some code you may use this simple utility I made a long time ago for this purpose.

Worked very nice, thank you !

Options: Reply | Quote | Up ^






Editor PSPad - freeware editor, © 2001 - 2024 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR