diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/irb/ruby-lex.rb | 8 |
2 files changed, 9 insertions, 4 deletions
@@ -1,3 +1,8 @@ +Wed Dec 26 00:59:18 2012 Keiju Ishitsuka <keiju@ishitsuka.com> + + * lib/irb/ruby-lex.rb: improve RubyLex performance for large files + [Bug #5202]. Patch by ryanmelt. + Tue Dec 25 22:21:06 2012 Keiju Ishitsuka <keiju@ishitsuka.com> * lib/irb/output-method.rb: raise right exception when diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb index 379b4b746d..239d6b1d86 100644 --- a/lib/irb/ruby-lex.rb +++ b/lib/irb/ruby-lex.rb @@ -87,8 +87,8 @@ class RubyLex end def get_readed - if idx = @readed.reverse.index("\n") - @base_char_no = idx + if idx = @readed.rindex("\n") + @base_char_no = @readed.size - (idx + 1) else @base_char_no += @readed.size end @@ -152,8 +152,8 @@ class RubyLex @seek -= 1 if c == "\n" @line_no -= 1 - if idx = @readed.reverse.index("\n") - @char_no = @readed.size - idx + if idx = @readed.rindex("\n") + @char_no = idx + 1 else @char_no = @base_char_no + @readed.size end |