summaryrefslogtreecommitdiff
path: root/lib/irb
diff options
context:
space:
mode:
authortomoya ishida <tomoyapenguin@gmail.com>2023-05-28 18:20:13 +0900
committergit <svn-admin@ruby-lang.org>2023-05-28 09:20:18 +0000
commitd5ef373b1194bac64784ae316d125d7a2cf1988a (patch)
tree7c820aca78ff0fa389b822416974e9d5c3cc6a21 /lib/irb
parent14abb799c93c8e5cb7ce36d829fb805f80397d4c (diff)
[ruby/irb] Set maximum document dialog height by
preferred_dialog_height provided by Reline (https://github.com/ruby/irb/pull/591) https://github.com/ruby/irb/commit/df6907aca9
Diffstat (limited to 'lib/irb')
-rw-r--r--lib/irb/input-method.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/irb/input-method.rb b/lib/irb/input-method.rb
index 992968ffdc..4e049b22db 100644
--- a/lib/irb/input-method.rb
+++ b/lib/irb/input-method.rb
@@ -401,6 +401,7 @@ module IRB
mod_key = RUBY_PLATFORM.match?(/darwin/) ? "Option" : "Alt"
message = "Press #{mod_key}+d to read the full document"
contents = [message] + doc.accept(formatter).split("\n")
+ contents = contents.take(preferred_dialog_height) if respond_to?(:preferred_dialog_height)
y = cursor_pos_to_render.y
DialogRenderInfo.new(pos: Reline::CursorPos.new(x, y), contents: contents, width: width, bg_color: '49')