summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyrylo Silin <silin@kyrylo.org>2018-10-26 04:36:25 +0800
committerGitHub <noreply@github.com>2018-10-26 04:36:25 +0800
commiteb9246d5330a9bb6b04d93c90099d95dd6f21106 (patch)
treef08932b3ca936946665e4184b46f412918984bdd
parent63b8571e425a77e190e8d2473f91904a320f557b (diff)
parent3aa7ebc7db8cd833dadae1235750a72bb2a04ba9 (diff)
downloadpry-eb9246d5330a9bb6b04d93c90099d95dd6f21106.tar.gz
Merge pull request #1825 from pry/1823-rbreadline-vi-mode-fix
repl: fix broken input while using rb-readline
-rw-r--r--lib/pry/repl.rb6
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