diff options
author | aycabta <[email protected]> | 2021-08-31 14:06:36 +0900 |
---|---|---|
committer | git <[email protected]> | 2021-08-31 15:20:22 +0900 |
commit | a8e6a850d571ea798ea52753f6b3252c33dd1270 (patch) | |
tree | 845ef9ba7e076540048ba3df84c3f68b11addbb2 /lib/irb/input-method.rb | |
parent | cf0ece810a72157437a76679bf22f7856afc16ca (diff) |
[ruby/irb] Make show doc dialog appears on the left at the right edge
https://github.com/ruby/irb/commit/6480eddd31
Diffstat (limited to 'lib/irb/input-method.rb')
-rw-r--r-- | lib/irb/input-method.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/irb/input-method.rb b/lib/irb/input-method.rb index f7a4fbab77..fb7e1d67cb 100644 --- a/lib/irb/input-method.rb +++ b/lib/irb/input-method.rb @@ -355,13 +355,15 @@ module IRB end end return nil if doc.nil? + width = 40 formatter = RDoc::Markup::ToAnsi.new - formatter.width = 40 - str = doc.accept(formatter) + formatter.width = width + contents = doc.accept(formatter).split("\n") - x = cursor_pos_to_render.x + 40 + x = cursor_pos_to_render.x + autocomplete_dialog.contents_width + x = cursor_pos_to_render.x - width if x + width >= screen_width y = cursor_pos_to_render.y + pointer - autocomplete_dialog.scroll_top - DialogRenderInfo.new(pos: Reline::CursorPos.new(x, y), contents: str.split("\n"), bg_color: '49') + DialogRenderInfo.new(pos: Reline::CursorPos.new(x, y), contents: contents, bg_color: '49') } # Reads the next line from this input method. |