RE: :Text::FindAndReplaceAll()
Nick Ing-Simmons <[email protected]>
| Newsgroups | gmane.comp.lang.perl.tk |
|---|---|
| Message-ID | <[email protected]> |
Jack D. <[email protected]> writes: >> -----Original Message----- >> From: [email protected] >> [mailto:[email protected]] On >> Behalf Of ????? ???????? >> Sent: December 16, 2005 7:34 AM >> To: [email protected] >> Subject: Tk::Text::FindAndReplaceAll() >> >> I have a Tk::TextUndo widget. It has context menu which also >> holds Replace option. >> I put a single word 'gallo' as a text. Than choose Replace >> (Direction: any, Mode: regexp, Case: any), put '.*' as a >> pattern and whatever as a replacement. Push "ReplaceAll". Works fine. >> Now I put as a text 'gallo' and from the next line 'ballo'. >> Than choose Replace (Direction: any, Mode: regexp, Case: >> any), put '.*' as a pattern and non-empty replacement. Push >> "ReplaceAll". The result - application is hanged (100% CPU >> consumption). Works fine however if replacement is empty. >> >> This wouldn't be the issue if >> $text_undo->FindAndReplaceAll('-regexp', '-case', qr/.*/, >> 'whatever'); didn't behave the same nasty way. >> >> Is it something I missed or is there a bug in Tk (ActivePerl >> 5.8.7.813)? > >Seems like a bug in the FindNext subroutine of Tk::Text. Basically using (.) >or (.*) doesn't seem to work properly. >i.e. the program gets stuck in a while loop because the $saved_insert never >matches the $compared_index in the source code. I have cc'd the ptk mailing >list for their thoughts. My original Text::Undo got somewhat hijacked and I am not a big fan of some of the implementation. I have emedded perl regexps in other editors and suggest it needs to quietly prepend a \G and set the string's pos(). > >Jack >-++**==--++**==--++**==--++**==--++**==--++**==--++**== >This message was posted through the Stanford campus mailing list >server. If you wish to unsubscribe from this mailing list, send the >message body of "unsubscribe ptk" to [email protected] -++**==--++**==--++**==--++**==--++**==--++**==--++**== This message was posted through the Stanford campus mailing list server. If you wish to unsubscribe from this mailing list, send the message body of "unsubscribe ptk" to [email protected]