diff options
-rw-r--r-- | lib/reline/ansi.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/reline/ansi.rb b/lib/reline/ansi.rb index a9fb959ce4..d2c32898b3 100644 --- a/lib/reline/ansi.rb +++ b/lib/reline/ansi.rb @@ -112,10 +112,11 @@ class Reline::ANSI @@input.raw do |stdin| @@output << "\e[6n" @@output.flush - while (c = stdin.getc) != 'R' - res << c if c + while (c = stdin.getc) + res << c + m = res.match(/\e\[(?<row>\d+);(?<column>\d+)R/) + break if m end - m = res.match(/\e\[(?<row>\d+);(?<column>\d+)/) (m.pre_match + m.post_match).chars.reverse_each do |ch| stdin.ungetc ch end |