diff options
author | Kyrylo Silin <silin@kyrylo.org> | 2018-10-26 04:33:36 +0800 |
---|---|---|
committer | Kyrylo Silin <silin@kyrylo.org> | 2018-10-26 04:33:36 +0800 |
commit | 3aa7ebc7db8cd833dadae1235750a72bb2a04ba9 (patch) | |
tree | f08932b3ca936946665e4184b46f412918984bdd | |
parent | 63b8571e425a77e190e8d2473f91904a320f557b (diff) | |
download | pry-3aa7ebc7db8cd833dadae1235750a72bb2a04ba9.tar.gz |
repl: fix broken input while using rb-readline
Fixes #1823 (Broken upstream when rb-readline is enabled)
-rw-r--r-- | lib/pry/repl.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/pry/repl.rb b/lib/pry/repl.rb index f3a7b7fa..afc7864d 100644 --- a/lib/pry/repl.rb +++ b/lib/pry/repl.rb @@ -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 |