Page 1 of 1

Panel To Shows Function Name, Add text on every line

Posted: Mon Nov 03, 2003 4:51 am
by hktang
Hi,

Actually got 2 enhancement I am looking for in Textpad.

1. Having a panel to shows/list out the functions inside a file. Sometimes there are so many lines that it is very difficult for me to find immediately a particular function inside a file.

2. Having a function to add text to the beginning/end/middle of every line.

Regards,
Tang

Posted: Mon Nov 03, 2003 7:54 am
by MudGuard
1. has been discussed a few times already...

2. Adding text to beginning/end of a line is a simple RegEx replacement:

Beginning:
Replace (with RegEx switched on)
^
by
AddedText

End:
Replace (with RegEx switched on)
$
by
Added Text

Middle of the line is more difficult, esp. if the lines have different lengths.
If you want to add text at a certain column (lets say 17), use
Replace (with RegEx switched on)
^(.{17})
by
\1Added Text

Or if you want to add your text a certain number of columns before the end of line (lets say 42)
Replace (with RegEx switched on)
(.{42})$
by
Added Text\1

If the lines have different lengths, there is no Textpad method known to me. Esp. as there is the trouble of defining the middle. With a line containing an even number of characters, it is no problem, but when there is an odd number, should text be added before or after the character in the middle?
I think that in this case, Regexes are out of the game, this needs more logic ==> a script of some sort...

Posted: Mon Nov 03, 2003 10:36 am
by s_reynisson
Regarding functions see http://textpad.com/forum/viewtopic.php?t=4576
and a few other posts.
I wrote an add-on that does all of this (and more):
http://findtag.sourceforge.net
Regards,
Frank

Posted: Tue Nov 04, 2003 3:29 am
by hktang
MudGuard wrote:1. has been discussed a few times already...

2. Adding text to beginning/end of a line is a simple RegEx replacement:

Beginning:
Replace (with RegEx switched on)
^
by
AddedText

End:
Replace (with RegEx switched on)
$
by
Added Text

Middle of the line is more difficult, esp. if the lines have different lengths.
If you want to add text at a certain column (lets say 17), use
Replace (with RegEx switched on)
^(.{17})
by
\1Added Text

Or if you want to add your text a certain number of columns before the end of line (lets say 42)
Replace (with RegEx switched on)
(.{42})$
by
Added Text\1

If the lines have different lengths, there is no Textpad method known to me. Esp. as there is the trouble of defining the middle. With a line containing an even number of characters, it is no problem, but when there is an odd number, should text be added before or after the character in the middle?
I think that in this case, Regexes are out of the game, this needs more logic ==> a script of some sort...

Hi MudGuard,

Thanks for your reply... it has been very helpful.
By the way, as there are a few discussion on the functions panel, is there going to be an add-on? or is this feature going to be integrated into the next version of textpad?

Regards,
Tang