1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Disable auto indent when move cursor up or down

This commit suppresses a strange behavior below:

  if true
    1[cursor]
  end

and press down key

  if true
  1
  end
This commit is contained in:
aycabta 2019-06-20 15:56:10 +09:00
parent e4cafa393f
commit c4c47b792d

View file

@ -784,6 +784,12 @@ class Reline::LineEditor
@completion_state = CompletionState::NORMAL
end
if @is_multiline and @auto_indent_proc
process_auto_indent
end
end
private def process_auto_indent
return if not @check_new_auto_indent and @previous_line_index # move cursor up or down
if @previous_line_index
new_lines = whole_lines(index: @previous_line_index, line: @line)
else
@ -805,7 +811,6 @@ class Reline::LineEditor
end
@check_new_auto_indent = false
end
end
def retrieve_completion_block
word_break_regexp = /\A[#{Regexp.escape(Reline.completer_word_break_characters)}]/