[ruby/reline] Improve OSC sequence regexp. OSC sequence can end with

ST(ESC\) and it should not to include \a and \e inside.
(https://github.com/ruby/reline/pull/527)

a88052adec
This commit is contained in:
tomoya ishida 2023-03-29 15:54:03 +09:00 committed by git
parent 8c8d068016
commit e26908dc4b
2 changed files with 12 additions and 1 deletions

View file

@ -38,7 +38,7 @@ class Reline::Unicode
NON_PRINTING_START = "\1"
NON_PRINTING_END = "\2"
CSI_REGEXP = /\e\[[\d;]*[ABCDEFGHJKSTfminsuhl]/
OSC_REGEXP = /\e\]\d+(?:;[^;]+)*\a/
OSC_REGEXP = /\e\]\d+(?:;[^;\a\e]+)*(?:\a|\e\\)/
WIDTH_SCANNER = /\G(?:(#{NON_PRINTING_START})|(#{NON_PRINTING_END})|(#{CSI_REGEXP})|(#{OSC_REGEXP})|(\X))/o
def self.get_mbchar_byte_size_by_first_char(c)