diff options
author | aycabta <aycabta@gmail.com> | 2019-06-18 20:57:58 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2019-06-18 20:58:18 +0900 |
commit | 235e72f17e2c02074721150035ffc30e339c307f (patch) | |
tree | 2b638b0d9051cdbd2ce88e971576e22b7d6771e7 /lib/irb/input-method.rb | |
parent | e6aa0a61fac94f16250412b8ac80657dd9d6d572 (diff) | |
download | ruby-235e72f17e2c02074721150035ffc30e339c307f.tar.gz |
Implement auto indent for multiline
Diffstat (limited to 'lib/irb/input-method.rb')
-rw-r--r-- | lib/irb/input-method.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/irb/input-method.rb b/lib/irb/input-method.rb index 68d2ad280c..dbed7da14b 100644 --- a/lib/irb/input-method.rb +++ b/lib/irb/input-method.rb @@ -244,6 +244,10 @@ module IRB @prompt_proc = block end + def auto_indent(&block) + @auto_indent_proc = block + end + # Reads the next line from this input method. # # See IO#gets for more information. @@ -251,6 +255,7 @@ module IRB Reline.input = @stdin Reline.output = @stdout Reline.prompt_proc = @prompt_proc + Reline.auto_indent_proc = @auto_indent_proc if l = readmultiline(@prompt, false, &@check_termination_proc) HISTORY.push(l) if !l.empty? @line[@line_no += 1] = l + "\n" |