Skip to content
Myr

Ignore xterm OSC control sequences

Before adoption: this commit came in with the history the project adopted, so no landing records it.

- OSC Ps ; Pt BEL - OSC Ps ; Pt ST Fix #1415

authored by Junegunn Choi · committed by Junegunn Choi · parent 6db15e8 · Browse files · 2 files+14 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+14 added−1 removed

  • tests:+12 added−0 removed
  • other:+2 added−1 removed

2 files+14 added−1 removed

modified:src/ansi.go+2 added-1 removed
88 unmodified lines
89 - https://github.com/gnachman/iTerm290 - http://ascii-table.com/ansi-escape-sequences.php91 - http://ascii-table.com/ansi-escape-sequences-vt-100.php92 - http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x405.html93 - https://invisible-island.net/xterm/ctlseqs/ctlseqs.html94 */95 // The following regular expression will include not all but most of the96 // frequently used ANSI sequences96 ansiRegex = regexp.MustCompile("(?:\x1b[\\[()][0-9;]*[a-zA-Z@]|\x1b.|[\x0e\x0f]|.\x08)")97 ansiRegex = regexp.MustCompile("(?:\x1b[\\[()][0-9;]*[a-zA-Z@]|\x1b][0-9];[[:print:]]+(?:\x1b\\\\|\x07)|\x1b.|[\x0e\x0f]|.\x08)")98}99100func findAnsiStart(str string) int {101 idx := 0
191 unmodified lines
modified:test/test_go.rb+12 added
1714 unmodified lines
1715 tmux.send_keys :BSpace1716 tmux.prepare1717 end17181719 def test_strip_xterm_osc_sequence1720 %W[\x07 \x1b\\].each do |esc|1721 writelines tempname, [%(printf $1"\e]4;3;rgb:aa/bb/cc#{esc} "$2)]1722 File.chmod(0o755, tempname)1723 tmux.prepare1724 tmux.send_keys(1725 %(echo foo bar | #{FZF} --preview '#{tempname} {2} {1}'), :Enter1726 )1727 tmux.until { |lines| lines.any_include?('bar foo') }1728 tmux.send_keys :Enter1729 end1730 end1731end17321733module TestShell1734 def setup
412 unmodified lines