ruby-changes:67571
From: aycabta <ko1@a...>
Date: Fri, 3 Sep 2021 04:28:35 +0900 (JST)
Subject: [ruby-changes:67571] f793f68264 (master): [ruby/irb] Add Alt+d trap from show doc dialog to show full doc
https://git.ruby-lang.org/ruby.git/commit/?id=f793f68264 From f793f682641030da81a45f5a9a0f3191f79a75c2 Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> 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(+) diff --git a/lib/irb/input-method.rb b/lib/irb/input-method.rb index 9539163..915c8fd 100644 --- a/lib/irb/input-method.rb +++ b/lib/irb/input-method.rb @@ -314,11 +314,14 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/input-method.rb#L314 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 https://github.com/ruby/ruby/blob/trunk/lib/irb/input-method.rb#L331 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 https://github.com/ruby/ruby/blob/trunk/lib/irb/input-method.rb#L369 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.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/