@@ -361,16 +361,24 @@ def show_doc_dialog_proc
361361 return nil unless x
362362
363363 dialog . trap_key = ALT_D_SEQUENCES
364- open_doc = key . match? ( dialog . name )
364+
365+ if key . match? ( dialog . name )
366+ begin
367+ print "\e [?1049h"
368+ input_method . display_document ( matched_text )
369+ ensure
370+ print "\e [?1049l"
371+ end
372+ end
365373
366374 contents = case target
367375 when CommandDocument
368- input_method . command_doc_dialog_contents ( target . name , width , open_doc : open_doc )
376+ input_method . command_doc_dialog_contents ( target . name , width )
369377 when MethodDocument
370- input_method . rdoc_dialog_contents ( target . name , width , open_doc : open_doc )
378+ input_method . rdoc_dialog_contents ( target . name , width )
371379 else
372380 if show_easter_egg
373- input_method . easter_egg_dialog_contents ( open_doc : open_doc )
381+ input_method . easter_egg_dialog_contents
374382 end
375383 end
376384 return nil unless contents
@@ -381,45 +389,24 @@ def show_doc_dialog_proc
381389 }
382390 end
383391
384- def command_doc_dialog_contents ( command_name , width , open_doc : false )
392+ def command_doc_dialog_contents ( command_name , width )
385393 command_class = IRB ::Command . load_command ( command_name )
386394 return unless command_class
387395
388- if open_doc
389- content = command_class . help_message || command_class . description
390- begin
391- print "\e [?1049h"
392- Pager . page_content ( content )
393- ensure
394- print "\e [?1049l"
395- end
396- end
397-
398396 [ PRESS_ALT_D_TO_READ_FULL_DOC , "" ] + command_class . doc_dialog_content ( command_name , width )
399397 end
400398
401- def easter_egg_dialog_contents ( open_doc : false )
402- IRB . __send__ ( :easter_egg ) if open_doc
399+ def easter_egg_dialog_contents
403400 type = STDOUT . external_encoding == Encoding ::UTF_8 ? :unicode : :ascii
404401 lines = IRB . send ( :easter_egg_logo , type ) . split ( "\n " )
405402 lines [ 0 ] [ 0 , PRESS_ALT_D_TO_SEE_MORE . size ] = PRESS_ALT_D_TO_SEE_MORE
406403 lines
407404 end
408405
409- def rdoc_dialog_contents ( name , width , open_doc : false )
406+ def rdoc_dialog_contents ( name , width )
410407 driver = rdoc_ri_driver
411408 return unless driver
412409
413- if open_doc
414- begin
415- print "\e [?1049h"
416- driver . display_names ( [ name ] )
417- rescue RDoc ::RI ::Driver ::NotFoundError
418- ensure
419- print "\e [?1049l"
420- end
421- end
422-
423410 name = driver . expand_name ( name )
424411
425412 doc = if name =~ /#|\. /
@@ -483,7 +470,9 @@ def display_document(matched)
483470 command_class = IRB ::Command . load_command ( target . name )
484471 if command_class
485472 content = command_class . help_message || command_class . description
486- Pager . page_content ( content )
473+ Pager . page ( retain_content : true ) do |io |
474+ io . puts content
475+ end
487476 end
488477 when MethodDocument
489478 driver = rdoc_ri_driver
0 commit comments