summaryrefslogtreecommitdiff
path: root/lib/reline.rb
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2021-08-25 17:21:05 +0900
committeraycabta <aycabta@gmail.com>2021-08-29 20:30:33 +0900
commitca1a2d1f68b299f07e9953f8d739a4b7c12bc7a0 (patch)
tree1ba8ce9810fdade299fadf424cea808acd76c43a /lib/reline.rb
parent06bd48aba8b24e73b1dac8dfdc1dc0f36a733c11 (diff)
[ruby/reline] Show autocomplete correctly when starts from prev line
https://github.com/ruby/reline/commit/f31a76ff31
Diffstat (limited to 'lib/reline.rb')
-rw-r--r--lib/reline.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/reline.rb b/lib/reline.rb
index 72621fe190..eafed48053 100644
--- a/lib/reline.rb
+++ b/lib/reline.rb
@@ -196,11 +196,15 @@ module Reline
result = nil
end
end
- x = cursor_pos.x - Reline::Unicode.calculate_width(target)
+ target_width = Reline::Unicode.calculate_width(target)
+ x = cursor_pos.x - target_width
if x < 0
x = screen_width + x
+ y = -1
+ else
+ y = 0
end
- [Reline::CursorPos.new(x, nil), result]
+ [Reline::CursorPos.new(x, y), result]
}
inner_readline(prompt, add_hist, true, &confirm_multiline_termination)