[ruby/reline] accept new_indent > cursor_max

https://github.com/ruby/reline/commit/61cc580da4
This commit is contained in:
tompng 2022-08-03 15:25:13 +09:00 коммит произвёл git
Родитель 0cc91871a8
Коммит 4241b3cf2d
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -1724,17 +1724,18 @@ class Reline::LineEditor
new_lines = whole_lines
end
new_indent = @auto_indent_proc.(new_lines, @line_index, @byte_pointer, @check_new_auto_indent)
new_indent = @cursor_max if new_indent&.> @cursor_max
if new_indent&.>= 0
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].lstrip
line = @buffer_of_lines[@line_index] = ' ' * new_indent + @buffer_of_lines[@line_index].lstrip
@cursor = new_indent
@cursor_max = calculate_width(line)
@byte_pointer = new_indent
else
@line = ' ' * new_indent + @line.lstrip
@cursor += new_indent - prev_indent
@cursor_max = calculate_width(@line)
@byte_pointer += new_indent - prev_indent
end
end