Skip to content

Commit

Permalink
Make show doc dialog appears on the left at the right edge
Browse files Browse the repository at this point in the history
  • Loading branch information
aycabta committed Aug 31, 2021
1 parent f8b752b commit 6480edd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/irb/input-method.rb
Expand Up @@ -355,13 +355,15 @@ def auto_indent(&block)
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.
Expand Down

0 comments on commit 6480edd

Please sign in to comment.