ruby-changes:62738
From: tompng <ko1@a...>
Date: Fri, 28 Aug 2020 11:20:30 +0900 (JST)
Subject: [ruby-changes:62738] cdd7d41046 (master): [ruby/reline] fix cursor_pos regexp match
https://git.ruby-lang.org/ruby.git/commit/?id=cdd7d41046 From cdd7d41046f6c91dfa8a1f0612dc686b79f6e849 Mon Sep 17 00:00:00 2001 From: tompng <tomoyapenguin@g...> Date: Tue, 28 Jul 2020 17:25:06 +0900 Subject: [ruby/reline] fix cursor_pos regexp match https://github.com/ruby/reline/commit/1dd80ef188 diff --git a/lib/reline/ansi.rb b/lib/reline/ansi.rb index a9fb959..d2c3289 100644 --- a/lib/reline/ansi.rb +++ b/lib/reline/ansi.rb @@ -112,10 +112,11 @@ class Reline::ANSI https://github.com/ruby/ruby/blob/trunk/lib/reline/ansi.rb#L112 @@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 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/