summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-07-04 18:46:34 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-07-04 18:47:22 +0900
commitee861e43f70d827abd1f8d26b2e97920237348b4 (patch)
tree6afb0e9f5bfe4e4cb728e0acb2ec5db8992bc6b4
parent0c3e6e86bdcb708d283dc57ed3c18ed1b40e4a17 (diff)
Skip indented comment lines [Bug #15981]
-rw-r--r--lib/reline/config.rb2
-rw-r--r--test/reline/test_config.rb5
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/reline/config.rb b/lib/reline/config.rb
index 1415a39194..760777997e 100644
--- a/lib/reline/config.rb
+++ b/lib/reline/config.rb
@@ -119,7 +119,7 @@ class Reline::Config
@if_stack = []
lines.each_with_index do |line, no|
- next if line.start_with?('#')
+ next if line.match(/\A\s*#/)
no += 1
diff --git a/test/reline/test_config.rb b/test/reline/test_config.rb
index 768be3dafb..ee006b72dc 100644
--- a/test/reline/test_config.rb
+++ b/test/reline/test_config.rb
@@ -28,6 +28,11 @@ class Reline::Config::Test < Reline::TestCase
assert_equal :audible, @config.instance_variable_get(:@bell_style)
end
+ def test_comment_line
+ @config.read_lines([" #a: error\n"])
+ assert_not_include @config.key_bindings, nil
+ end
+
def test_bind_key
assert_equal ['input'.bytes, 'abcde'.bytes], @config.bind_key('"input"', '"abcde"')
end