[Bug #1969] irb will be stuck with long variable name with completion.rb

Bug #1969: irb will be stuck with long variable name with completion.rb
http://redmine.ruby-lang.org/issues/show/1969

e$B5/I<<Te(B: Yoshimasa Niwa
e$B%9%F!<%?%9e(B: Open, e$BM%@hEYe(B: Normal
ruby -v: ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9]

Requiring “irb/completion”, we then hit Tab after a long variable name,
irb will be stuck.

% irb
irb(main):001:0> require ‘irb/completion’
=> true
irb(main):002:0> a.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[Hit Tab key]
(Nothing happen, just eating CPU)
irb(main):002:0> ::a::BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB[Hit Tab key]
(Nothing happen, just eating CPU)

I attached the patches to fix this issue.
This issue seems to be caused by a problem of longest matching of
regular expressions.
These patches are based on Haruo N. [email protected]’s good
suggestions.

irbe$B$Ge(Birb/completione$B$,e(Brequiree$B$5$l$F$$$k$H$-$K!“D9$$JQ?tL>!”%/%i%9L>$N8e$Ge(BTabe$B$r2!$9$H8G$^$j$^$9!#e(B
e$B@55,I=8=$N:GD90lCW$NLdBj$H;W$o$l$^$9!#e(B
e$BFnLZ$5$se(B[email protected]e$B$N;XE&$r$b$H$K:n@.$7$?%Q%C%A$rE:IU$7$^$9$N$G$43NG’$/$@$5$$!#e(B

e$B%A%1%C%He(B #1969 e$B$,99?7$5$l$^$7$?!#e(B (by Yusuke E.)

e$BC4Ev<Te(B Keiju Ishitsukae$B$K%;%C%He(B

e$B1sF#$G$9!#e(B

2009e$BG/e(B8e$B7ne(B21e$BF|e(B2:56 Yoshimasa Niwa
[email protected]:

I attached the patches to fix this issue.
This issue seems to be caused by a problem of longest matching of regular expressions.
These patches are based on Haruo N. [email protected]’s good suggestions.

irbe$B$Ge(Birb/completione$B$,e(Brequiree$B$5$l$F$$$k$H$-$K!“D9$$JQ?tL>!”%/%i%9L>$N8e$Ge(BTabe$B$r2!$9$H8G$^$j$^$9!#e(B
e$B@55,I=8=$N:GD90lCW$NLdBj$H;W$o$l$^$9!#e(B
e$BFnLZ$5$se(B[email protected]e$B$N;XE&$r$b$H$K:n@.$7$?%Q%C%A$rE:IU$7$^$9$N$G$43NG’$/$@$5$$!#e(B

e$BCY$$H?1~$G$9$_$^$;$s!#e(B

e$B:F8=$7$^$7$?!#D:$$$?%Q%C%A$O$?$V$sLdBj$J$$$H;W$$$^$9!#e(B
e$B$$$7$D$+$5$s!"<h$j9~$s$G$$$$$G$7$g$&$+!#e(B

(.?[^.]+)+ e$B$Oe(B .+ e$B$HF1CM$J5$$b$7$^$9$,e(B


Yusuke E. [email protected]

http://redmine.ruby-lang.org/issues/show/1969

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

In [ruby-dev:40935] the message: “[ruby-dev:40935] [Bug #1969] irb
will be stuck with long variable name with completion.rb”, on Apr/08
23:17(JST) Yusuke E. writes:

(.?[^.]+)+ e$B$Oe(B .+ e$B$HF1CM$J5$$b$7$^$9$,e(B

e$B$&!<$`e(B.
e$B$d$j$?$+$C$?$3$H$r;W$$=P$7$F$b$&0lEY@55,I=8=$r=q$-49$($^$7$?e(B.
e$B$3$l$Ge(B, e$B$?$V$sBg>fIW$G$O$J$$$+$He(B…

e$B$=$l$He(B, [ruby-core:28366] e$B$N%3%_%C%H$G$9$,e(B,
e$B1i;;;R$NM%@hEY$r9M$($k$H4Ve(B
e$B0c$C$F$$$^$9$N$Ge(B, e$B$=$C$A$bD>$7$F$*$-$^$7$?e(B.

__
---------------------------------------------------->> e$B@PDMe(B
e$B7=<ye(B <<—
---------------------------------->> e-mail: [email protected] <<—

e$B1sF#$G$9!#e(B

2010e$BG/e(B4e$B7ne(B9e$BF|e(B21:31 e$B@PDM7=<ye(B
[email protected]:

(.?[^.]+)+ e$B$Oe(B .+ e$B$HF1CM$J5$$b$7$^$9$,e(B

e$B$&!<$`e(B. e$B$d$j$?$+$C$?$3$H$r;W$$=P$7$F$b$&0lEY@55,I=8=$r=q$-49$($^$7$?e(B.
e$B$3$l$Ge(B, e$B$?$V$sBg>fIW$G$O$J$$$+$He(B…

e$B$$!“$?$V$sBg>fIW$=$&$K8+$($^$9!#$”$j$,$H$&$4$6$$$^$9!#e(B

e$B$=$l$He(B, [ruby-core:28366] e$B$N%3%_%C%H$G$9$,e(B, e$B1i;;;R$NM%@hEY$r9M$($k$H4Ve(B
e$B0c$C$F$$$^$9$N$Ge(B, e$B$=$C$A$bD>$7$F$*$-$^$7$?e(B.

e$B$“$j$c!”<:Ni$7$^$7$?!#$"$j$,$H$&$4$6$$$^$9!#e(B

e$B%A%1%C%He(B #1969 e$B$,99?7$5$l$^$7$?!#e(B (by Yusuke E.)

e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B

e$B1sF#$G$9!#e(B

r27271 e$B$G=$@5$7$F$$$?$@$-$^$7$?!#e(B


Yusuke E. [email protected]

http://redmine.ruby-lang.org/issues/show/1969