logo       

Re: :Text::FindAndReplaceAll(): msg#00056

Subject: Re: :Text::FindAndReplaceAll()
"Jack D." <goodcall1@xxxxxxxxxxx> writes:

>  
> > -----Original Message-----
> > From: perl-win32-users-bounces@xxxxxxxxxxxxxxxxxxxxxxxx 
> > [mailto:perl-win32-users-bounces@xxxxxxxxxxxxxxxxxxxxxxxx] On 
> > Behalf Of ????? ????????
> > Sent: December 16, 2005 7:34 AM
> > To: perl-win32-users@xxxxxxxxxxxxxxxxxxxxxxxx
> > 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. 
> 

If you add

   ($direction eq '-forward' ? 'end' : '1.0')

as last argument of both search() calls in Tk::Text::FindNext(), then
the search has a stopindex and it seems to work. But it's unclear to
me if this is the correct solution, because it prevents from
"wrapping" the search. Anyway, what's the exact semantics of FindNext?
Maybe it's better to give FindNext() another optional argument for the
stopindex?

Regards,
        Slaven

-- 
Slaven Rezic - slaven <at> rezic <dot> de

    Berlin Perl Mongers - http://berlin.pm.org
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
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 majordomo@xxxxxxxxxxxxxxxxxx



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe