diff options
author | aycabta <aycabta@gmail.com> | 2019-06-27 01:20:44 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2019-06-27 01:21:06 +0900 |
commit | 72bfc52de67d774316ca872a036476aa51886ab0 (patch) | |
tree | 5e11af87e041ee860860e15423583ec990f0eb07 /lib | |
parent | d004989ac6355bcf2840ed190aae139c3a852848 (diff) |
Decrease indent by closing token correctly
Diffstat (limited to 'lib')
-rw-r--r-- | lib/reline/line_editor.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index f787fb08a5..f068a3c821 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -797,7 +797,7 @@ class Reline::LineEditor end new_indent = @auto_indent_proc.(new_lines, @line_index, @byte_pointer, @check_new_auto_indent) if new_indent - md = @buffer_of_lines[@line_index].match(/\A */) + md = new_lines[@line_index].match(/\A */) prev_indent = md[0].count(' ') if @check_new_auto_indent @buffer_of_lines[@line_index] = ' ' * new_indent + @buffer_of_lines[@line_index].gsub(/\A */, '') @@ -805,8 +805,8 @@ class Reline::LineEditor @byte_pointer = new_indent else @line = ' ' * new_indent + @line.gsub(/\A */, '') - @cursor -= prev_indent - new_indent - @byte_pointer -= prev_indent - new_indent + @cursor += new_indent - prev_indent + @byte_pointer += new_indent - prev_indent end end @check_new_auto_indent = false |