summaryrefslogtreecommitdiff
path: root/lib/reline.rb
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2019-06-18 20:57:58 +0900
committeraycabta <aycabta@gmail.com>2019-06-18 20:58:18 +0900
commit235e72f17e2c02074721150035ffc30e339c307f (patch)
tree2b638b0d9051cdbd2ce88e971576e22b7d6771e7 /lib/reline.rb
parente6aa0a61fac94f16250412b8ac80657dd9d6d572 (diff)
Implement auto indent for multiline
Diffstat (limited to 'lib/reline.rb')
-rw-r--r--lib/reline.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/reline.rb b/lib/reline.rb
index ff29a2539b..191d8bb158 100644
--- a/lib/reline.rb
+++ b/lib/reline.rb
@@ -186,6 +186,15 @@ module Reline
@@prompt_proc = p
end
+ @@auto_indent_proc = nil
+ def self.auto_indent_proc
+ @@auto_indent_proc
+ end
+ def self.auto_indent_proc=(p)
+ raise ArgumentError unless p.is_a?(Proc)
+ @@auto_indent_proc = p
+ end
+
@@pre_input_hook = nil
def self.pre_input_hook
@@pre_input_hook
@@ -330,6 +339,7 @@ module Reline
@@line_editor.completion_proc = @@completion_proc
@@line_editor.output_modifier_proc = @@output_modifier_proc
@@line_editor.prompt_proc = @@prompt_proc
+ @@line_editor.auto_indent_proc = @@auto_indent_proc
@@line_editor.dig_perfect_match_proc = @@dig_perfect_match_proc
@@line_editor.pre_input_hook = @@pre_input_hook
@@line_editor.rerender