Panel To Shows Function Name, Add text on every line

Ideas for new features

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
hktang
Posts: 2
Joined: Mon Nov 03, 2003 4:42 am

Panel To Shows Function Name, Add text on every line

Post 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
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post 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...
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post 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
Then I open up and see
the person fumbling here is me
a different way to be
hktang
Posts: 2
Joined: Mon Nov 03, 2003 4:42 am

Post 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
Post Reply