aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2021-01-05 18:22:00 +0900
committeraycabta <aycabta@gmail.com>2021-01-08 13:25:18 +0900
commit88af5085dbf61dcd815e66aa9fe96c7d612c9747 (patch)
treec2c4bb0356d717be36e0793748c384dd4498fa8b /lib
parente356b71d35bf3746bec7fa1a309338151dbde43a (diff)
downloadruby-88af5085dbf61dcd815e66aa9fe96c7d612c9747.tar.gz
[ruby/reline] Suppress crashing when auto_indent_proc returns broken indent info
Co-authored-by: Juanito Fatas <me@juanitofatas.com> https://github.com/ruby/reline/commit/7c24276275
Diffstat (limited to 'lib')
-rw-r--r--lib/reline/line_editor.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 10c94db753..bf2732823b 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -1131,6 +1131,7 @@ 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(' ')