diff options
author | aycabta <aycabta@gmail.com> | 2021-08-25 17:21:05 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2021-08-29 20:30:33 +0900 |
commit | ca1a2d1f68b299f07e9953f8d739a4b7c12bc7a0 (patch) | |
tree | 1ba8ce9810fdade299fadf424cea808acd76c43a /lib/reline.rb | |
parent | 06bd48aba8b24e73b1dac8dfdc1dc0f36a733c11 (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.rb | 8 |
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) |