mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[reline] Do not compile regexp for each line
This commit is contained in:
parent
a6e32855d0
commit
b40589802b
1 changed files with 4 additions and 5 deletions
|
@ -126,20 +126,19 @@ class Reline::Config
|
||||||
no += 1
|
no += 1
|
||||||
|
|
||||||
line = line.chomp.lstrip
|
line = line.chomp.lstrip
|
||||||
if line[0, 1] == '$'
|
if line.start_with?('$')
|
||||||
handle_directive(line[1..-1], file, no)
|
handle_directive(line[1..-1], file, no)
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
next if @skip_section
|
next if @skip_section
|
||||||
|
|
||||||
if line.match(/^set +([^ ]+) +([^ ]+)/i)
|
case line
|
||||||
|
when /^set +([^ ]+) +([^ ]+)/i
|
||||||
var, value = $1.downcase, $2.downcase
|
var, value = $1.downcase, $2.downcase
|
||||||
bind_variable(var, value)
|
bind_variable(var, value)
|
||||||
next
|
next
|
||||||
end
|
when /\s*("#{KEYSEQ_PATTERN}+")\s*:\s*(.*)\s*$/o
|
||||||
|
|
||||||
if line =~ /\s*("#{KEYSEQ_PATTERN}+")\s*:\s*(.*)\s*$/
|
|
||||||
key, func_name = $1, $2
|
key, func_name = $1, $2
|
||||||
keystroke, func = bind_key(key, func_name)
|
keystroke, func = bind_key(key, func_name)
|
||||||
next unless keystroke
|
next unless keystroke
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue