mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix auto indent crash when blank input
This commit is contained in:
parent
32e65e9e5a
commit
84903b31c8
1 changed files with 2 additions and 1 deletions
|
@ -70,7 +70,8 @@ class RubyLex
|
|||
prev_spaces + (indent - prev_indent) * 2
|
||||
else
|
||||
code = line_index.zero? ? '' : lines[0..(line_index - 1)].map{ |l| l + "\n" }.join
|
||||
code += lines[line_index].byteslice(0, byte_pointer)
|
||||
last_line = lines[line_index]&.byteslice(0, byte_pointer)
|
||||
code += last_line if last_line
|
||||
@tokens = Ripper.lex(code)
|
||||
indent, close_token = process_nesting_level(check_closing: true)
|
||||
if close_token
|
||||
|
|
Loading…
Add table
Reference in a new issue