Fix auto-indent behavior correctly
This commit is contained in:
parent
14a17063a1
commit
027e847cd2
@ -366,9 +366,9 @@ class RubyLex
|
|||||||
spaces_of_nest = []
|
spaces_of_nest = []
|
||||||
spaces_at_line_head = 0
|
spaces_at_line_head = 0
|
||||||
@tokens.each_with_index do |t, index|
|
@tokens.each_with_index do |t, index|
|
||||||
corresponding_token_depth = nil
|
|
||||||
case t[1]
|
case t[1]
|
||||||
when :on_ignored_nl, :on_nl, :on_comment
|
when :on_ignored_nl, :on_nl, :on_comment
|
||||||
|
corresponding_token_depth = nil
|
||||||
spaces_at_line_head = 0
|
spaces_at_line_head = 0
|
||||||
is_first_spaces_of_line = true
|
is_first_spaces_of_line = true
|
||||||
is_first_printable_of_line = true
|
is_first_printable_of_line = true
|
||||||
|
@ -815,12 +815,9 @@ class Reline::LineEditor
|
|||||||
@line = ' ' * new_indent + @line.lstrip
|
@line = ' ' * new_indent + @line.lstrip
|
||||||
|
|
||||||
new_indent = nil
|
new_indent = nil
|
||||||
(new_lines[-2].size + 1).times do |n|
|
result = @auto_indent_proc.(new_lines[0..-2], @line_index - 1, (new_lines[-2].size + 1), false)
|
||||||
result = @auto_indent_proc.(new_lines[0..-2], @line_index - 1, n, false)
|
if result
|
||||||
if result
|
new_indent = result
|
||||||
new_indent = result
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if new_indent&.>= 0
|
if new_indent&.>= 0
|
||||||
@line = ' ' * new_indent + @line.lstrip
|
@line = ' ' * new_indent + @line.lstrip
|
||||||
|
Loading…
x
Reference in New Issue
Block a user