summaryrefslogtreecommitdiff
path: root/lib/reline
diff options
context:
space:
mode:
authortompng <tomoyapenguin@gmail.com>2020-07-28 17:25:06 +0900
committeraycabta <aycabta@gmail.com>2020-08-28 11:05:18 +0900
commitcdd7d41046f6c91dfa8a1f0612dc686b79f6e849 (patch)
tree68147c2fb963d685fc1fea43845cae987a6c08af /lib/reline
parent8882927036a6630c6132f0a2067bdec64d9ca94d (diff)
[ruby/reline] fix cursor_pos regexp match
https://github.com/ruby/reline/commit/1dd80ef188
Diffstat (limited to 'lib/reline')
-rw-r--r--lib/reline/ansi.rb7
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