summaryrefslogtreecommitdiff
path: root/lib/irb/input-method.rb
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2019-05-31 06:03:18 +0900
committerTakashi Kokubun <takashikkbn@gmail.com>2019-05-31 06:54:00 +0900
commitcb40a21da0687b5dd3cd251c9e66bb0edf67f2b9 (patch)
treea442d7f71100bd7547bb341371cb7d51e645bb33 /lib/irb/input-method.rb
parent6e052817f95095217b67256aff48cedbd57717cf (diff)
Warn compile_error only when input is finished
Let's say we are in progress to write `"foo"`: ``` irb> "fo ``` at this moment, nothing is wrong. It would be just a normal way to write `"foo"`. Prior to this commit, the `fo` part was warned because of 5b64d7ac6e7cbf759b859428f125539e58bac0bd. But I think warning such a normal input is not valuable for users. However, we'd like to warn `:@1` or `@@1` which is also a syntax error. Then this commit switches the syntax highlight based on whether the input text is finished or not. When it's not finished yet, it does not warn compile_error.
Diffstat (limited to 'lib/irb/input-method.rb')
-rw-r--r--lib/irb/input-method.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/irb/input-method.rb b/lib/irb/input-method.rb
index 9d3580a192..aa62a628c8 100644
--- a/lib/irb/input-method.rb
+++ b/lib/irb/input-method.rb
@@ -224,9 +224,9 @@ module IRB
Reline.completion_proc = IRB::InputCompletor::CompletionProc
Reline.output_modifier_proc =
if IRB.conf[:USE_COLORIZE]
- proc do |output|
+ proc do |output, complete:|
next unless IRB::Color.colorable?
- IRB::Color.colorize_code(output)
+ IRB::Color.colorize_code(output, complete: complete)
end
else
proc do |output|