block-comment macro broke in TP 7

General questions about using TextPad

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

Post Reply
SamuelReynolds
Posts: 9
Joined: Tue Dec 28, 2004 10:55 pm
Location: Colorado
Contact:

block-comment macro broke in TP 7

Post by SamuelReynolds »

I just upgraded from TP5 to TP7.0.9.

I have used the following regex substitution (stored as a macro) for years to comment out selected blocks of code:
  • find: ^
  • replace with: #
I just upgraded to TP 7.0.9, and this substitution broke: it now adds the # to the start of the following line, which is not selected.

Example
  • Before:

    Code: Select all

        if len(sys.argv) > 2:
            flUDP = ( len(sys.argv) == 3 and sys.argv[2] == 'udp' )
            flSNMP = ( len(sys.argv) == 3 and sys.argv[2] == 'snmp' )
            flIP  = ( len(sys.argv) == 3 and sys.argv[2] == 'ip' )
            flTCP = ( len(sys.argv) == 3 and sys.argv[2] == 'tcp' )
    
            parse_class = UDP
    
    Select 1st 4 lines, and do substitution. Result:

    Code: Select all

    #    if len(sys.argv) > 2:
    #        flUDP = ( len(sys.argv) == 3 and sys.argv[2] == 'udp' )
    #        flSNMP = ( len(sys.argv) == 3 and sys.argv[2] == 'snmp' )
    #        flIP  = ( len(sys.argv) == 3 and sys.argv[2] == 'ip' )
            flTCP = ( len(sys.argv) == 3 and sys.argv[2] == 'tcp' )
    
            parse_class = UDP
    
  • In TP 7.0.9:
    Select 1st 4 lines, and do substitution. Result:

    Code: Select all

    #    if len(sys.argv) > 2:
    #        flUDP = ( len(sys.argv) == 3 and sys.argv[2] == 'udp' )
    #        flSNMP = ( len(sys.argv) == 3 and sys.argv[2] == 'snmp' )
    #        flIP  = ( len(sys.argv) == 3 and sys.argv[2] == 'ip' )
    #        flTCP = ( len(sys.argv) == 3 and sys.argv[2] == 'tcp' )
    
            parse_class = UDP
    
[/code]

This looks like a regex bug to me. If so, I'd like to request a prompt fix. If not, I'd like to understand why it now works as it does, and how I can get the new regex engine to do what I want.
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Yes, this is a bug. What is weirder is it doesn't do it all the time.

Also, if you select a whole number of lines, some of which are blank, and replace ^ by anything, then the replacement is not made on each line following a blank line.

Also, if you select a whole number of lines that are followed by a blank line, and replace $ by anything, one too many replacements is made.
SamuelReynolds
Posts: 9
Joined: Tue Dec 28, 2004 10:55 pm
Location: Colorado
Contact:

Any response would be nice...

Post by SamuelReynolds »

Is there any chance of this being fixed soon?

I've used TextPad as my programming editor for years, and block commenting has become automatic: select block, hit alt-\. Done.

Now, select block and alt-\ has become select block and alt-\-o-crap-rightarrow-rightarrow-delete, and it is driving me bonkers.

So far as I'm concerned, this bug by itself makes TP7 unusable. (The fact that it can't seem to remember my workspace and always opens without it is just crap on the cake.)

I'm at the point of "down"grading to TP 6. Or even to TP 5, which has just worked for me for so long.
Post Reply