1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

repl: fix broken input while using rb-readline

Fixes #1823 (Broken upstream when rb-readline is enabled)
This commit is contained in:
Kyrylo Silin 2018-10-26 04:33:36 +08:00
parent 63b8571e42
commit 3aa7ebc7db

View file

@ -241,7 +241,11 @@ class Pry
# indicators in 99% of cases.
def calculate_overhang(current_prompt, original_val, indented_val)
overhang = original_val.length - indented_val.length
if readline_available? && Readline.vi_editing_mode?
if readline_available? &&
# rb-readline doesn't support this method:
# https://github.com/ConnorAtherton/rb-readline/issues/152
Readline.respond_to?(:vi_editing_mode?) &&
Readline.vi_editing_mode?
overhang += current_prompt.length - indented_val.length
end
[0, overhang].max