ruby-changes:68306
From: aycabta <ko1@a...>
Date: Fri, 8 Oct 2021 10:33:59 +0900 (JST)
Subject: [ruby-changes:68306] 374efa8e30 (master): [ruby/irb] Specify whether to show the doc dialog on the left or right side by using variable names
https://git.ruby-lang.org/ruby.git/commit/?id=374efa8e30 From 374efa8e302c8cd19bf41e3f6f87582532cce79c Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Fri, 8 Oct 2021 10:21:55 +0900 Subject: [ruby/irb] Specify whether to show the doc dialog on the left or right side by using variable names https://github.com/ruby/irb/commit/a23a88b8c9 --- lib/irb/input-method.rb | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/lib/irb/input-method.rb b/lib/irb/input-method.rb index f005ed7474..9fba4ed852 100644 --- a/lib/irb/input-method.rb +++ b/lib/irb/input-method.rb @@ -367,27 +367,31 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/input-method.rb#L367 return nil if doc.nil? width = 40 - x = cursor_pos_to_render.x + autocomplete_dialog.width - if x + width > screen_width - old_width = screen_width - (x + 0) - new_x = autocomplete_dialog.column - width - new_x = 0 if new_x < 0 - new_width = width > autocomplete_dialog.column ? autocomplete_dialog.column : width - if old_width.positive? and new_width.positive? - if old_width >= new_width - width = old_width + right_x = cursor_pos_to_render.x + autocomplete_dialog.width + if right_x + width > screen_width + right_width = screen_width - (right_x + 0) + left_x = autocomplete_dialog.column - width + left_x = 0 if left_x < 0 + left_width = width > autocomplete_dialog.column ? autocomplete_dialog.column : width + if right_width.positive? and left_width.positive? + if right_width >= left_width + width = right_width + x = right_x else - width = new_width - x = new_x + width = left_width + x = left_x end - elsif old_width.positive? and new_width.negative? - width = old_width - elsif old_width.negative? and new_width.positive? - width = new_width - x = new_x + elsif right_width.positive? and left_width.negative? + width = right_width + x = right_x + elsif right_width.negative? and left_width.positive? + width = left_width + x = left_x else # Both are negative width. return nil end + else + x = right_x end formatter = RDoc::Markup::ToAnsi.new formatter.width = width -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/