aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2021-08-23 21:57:48 +0900
committeraycabta <aycabta@gmail.com>2021-08-29 20:30:33 +0900
commit85dd0ad5e00332f03835640ac01056d54d011468 (patch)
tree286a08ba16792dede3f69d9a66a1ebcbc249485b
parentd768eeeddbcc59166e7669471e6b3672eeed230c (diff)
downloadruby-85dd0ad5e00332f03835640ac01056d54d011468.tar.gz
[ruby/reline] Move dialog pos to left when goes beyond right edge
https://github.com/ruby/reline/commit/f1efa2b062
-rw-r--r--lib/reline/line_editor.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index d8e2842e6a..0f27237a1a 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -547,6 +547,10 @@ class Reline::LineEditor
lower_space = @highest_in_all - @first_line_started_from - @started_from - 1
@dialog_updown = nil
@dialog_column = pos.x
+ diff = (@dialog_column + DIALOG_WIDTH) - (@screen_size.last - 1)
+ if diff > 0
+ @dialog_column -= diff
+ end
if (lower_space + @rest_height) >= DIALOG_HEIGHT
@dialog_updown = :down
@dialog_vertical_offset = 1