[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
This commit is contained in:
tomoya ishida 2023-05-28 18:20:13 +09:00 committed by git
parent 14abb799c9
commit d5ef373b11

View File

@ -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')