Skip to content

Commit

Permalink
[ruby/reline] accept new_indent > cursor_max
Browse files Browse the repository at this point in the history
  • Loading branch information
tompng authored and matzbot committed Jan 20, 2023
1 parent 0cc9187 commit 4241b3c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/reline/line_editor.rb
Expand Up @@ -1724,17 +1724,18 @@ def call_completion_proc_with_checking_args(pre, target, post)
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
Expand Down

0 comments on commit 4241b3c

Please sign in to comment.