diff options
author | tompng <[email protected]> | 2022-08-03 15:25:13 +0900 |
---|---|---|
committer | git <[email protected]> | 2023-01-20 13:40:15 +0000 |
commit | 4241b3cf2db3eb4a911de4485b60a4766237746b (patch) | |
tree | caab93c99882410ac3b5eb152087fbb0354ec7c5 /lib/reline/line_editor.rb | |
parent | 0cc91871a81aeb3152fcb72b5a50bcee2f7d03b0 (diff) |
[ruby/reline] accept new_indent > cursor_max
https://github.com/ruby/reline/commit/61cc580da4
Diffstat (limited to 'lib/reline/line_editor.rb')
-rw-r--r-- | lib/reline/line_editor.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index a1402a0f9e..b942a00844 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -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 |