-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix [nil] is passed to auto_indent_proc when exit with CTRL+d #571
Conversation
It seems Could you investigate why auto_indent_proc is called and can the call be skipped? If it's hard for us to fix auto_indent_proc call, I think this fix is good and can be merged. |
@tompng hi.
If C-d is entered, reline/lib/reline/line_editor.rb Lines 2601 to 2608 in 2503ddb
So the simple modification is as follows. diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 7ad56a3..5b98df0 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -1605,7 +1605,7 @@ class Reline::LineEditor
else
@just_cursor_moving = false
end
- if @is_multiline and @auto_indent_proc and not simplified_rendering?
+ if @is_multiline and @auto_indent_proc and not simplified_rendering? and not finished?
process_auto_indent
end
end However, |
When auto_indent_proc returns non-zero value require 'reline'
Reline.auto_indent_proc=->(*){2}
Reline.readmultiline('>'){true}
reline/lib/reline/line_editor.rb Line 1673 in 2503ddb
We need to find a way to skip calling Thanks for investigating and description about |
@tompng OK, Fixed it. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
CTRL+d (ruby/reline#571) * Fix [nil] is passed to auto_indent_proc when exit with CTRL+d Fix it ruby/reline#556 * not call auto_indent_proc when Ctrl+d. see: ruby/reline#571 (comment) ruby/reline@0924f2a075
Fix it #556
auto_indent_proc
will argument["]
instead of[nil]
.