summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/irb/ruby-lex.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb
index 8164fd2a17..41891f8987 100644
--- a/lib/irb/ruby-lex.rb
+++ b/lib/irb/ruby-lex.rb
@@ -308,6 +308,9 @@ class RubyLex
def check_newline_depth_difference
depth_difference = 0
+ if @tokens.size >= 2 and @tokens.last[2].end_with?("\n") and @tokens[-2][3].nobits?(Ripper::EXPR_END | Ripper::EXPR_ENDFN)
+ return 1
+ end
@tokens.each_with_index do |t, index|
case t[1]
when :on_ignored_nl, :on_nl