From f793f682641030da81a45f5a9a0f3191f79a75c2 Mon Sep 17 00:00:00 2001 From: aycabta Date: Fri, 3 Sep 2021 01:17:10 +0900 Subject: [ruby/irb] Add Alt+d trap from show doc dialog to show full doc https://github.com/ruby/irb/commit/368327b082 --- lib/irb/input-method.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/irb/input-method.rb') diff --git a/lib/irb/input-method.rb b/lib/irb/input-method.rb index 953916308e..915c8fd075 100644 --- a/lib/irb/input-method.rb +++ b/lib/irb/input-method.rb @@ -314,11 +314,14 @@ module IRB end SHOW_DOC_DIALOG = ->() { + dialog.trap_key = nil + alt_d = 0xE4 begin require 'rdoc' rescue LoadError return nil end + if just_cursor_moving and completion_journey_data.nil? return nil end @@ -328,6 +331,14 @@ module IRB name = IRB::InputCompletor.retrieve_completion_data(name, doc_namespace: true) driver = RDoc::RI::Driver.new + + if key.combined_char == alt_d + begin + driver.display_names([name]) + rescue RDoc::RI::Driver::NotFoundError + end + end + begin name = driver.expand_name(name) rescue RDoc::RI::Driver::NotFoundError @@ -358,6 +369,7 @@ module IRB width = 40 formatter = RDoc::Markup::ToAnsi.new formatter.width = width + dialog.trap_key = alt_d contents = doc.accept(formatter).split("\n") x = cursor_pos_to_render.x + autocomplete_dialog.width -- cgit v1.2.3