mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2025-02-03 04:28:36 +00:00
Ignore xterm OSC control sequences
- OSC Ps ; Pt BEL - OSC Ps ; Pt ST Fix #1415
This commit is contained in:
parent
6db15e8693
commit
dd49e41c42
@ -90,10 +90,11 @@ func init() {
|
|||||||
- http://ascii-table.com/ansi-escape-sequences.php
|
- http://ascii-table.com/ansi-escape-sequences.php
|
||||||
- http://ascii-table.com/ansi-escape-sequences-vt-100.php
|
- http://ascii-table.com/ansi-escape-sequences-vt-100.php
|
||||||
- http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x405.html
|
- http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x405.html
|
||||||
|
- https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
|
||||||
*/
|
*/
|
||||||
// The following regular expression will include not all but most of the
|
// The following regular expression will include not all but most of the
|
||||||
// frequently used ANSI sequences
|
// frequently used ANSI sequences
|
||||||
ansiRegex = regexp.MustCompile("(?:\x1b[\\[()][0-9;]*[a-zA-Z@]|\x1b.|[\x0e\x0f]|.\x08)")
|
ansiRegex = regexp.MustCompile("(?:\x1b[\\[()][0-9;]*[a-zA-Z@]|\x1b][0-9];[[:print:]]+(?:\x1b\\\\|\x07)|\x1b.|[\x0e\x0f]|.\x08)")
|
||||||
}
|
}
|
||||||
|
|
||||||
func findAnsiStart(str string) int {
|
func findAnsiStart(str string) int {
|
||||||
|
@ -1716,6 +1716,18 @@ class TestGoFZF < TestBase
|
|||||||
tmux.prepare
|
tmux.prepare
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_strip_xterm_osc_sequence
|
||||||
|
%W[\x07 \x1b\\].each do |esc|
|
||||||
|
writelines tempname, [%(printf $1"\e]4;3;rgb:aa/bb/cc#{esc} "$2)]
|
||||||
|
File.chmod(0o755, tempname)
|
||||||
|
tmux.prepare
|
||||||
|
tmux.send_keys(
|
||||||
|
%(echo foo bar | #{FZF} --preview '#{tempname} {2} {1}'), :Enter
|
||||||
|
)
|
||||||
|
tmux.until { |lines| lines.any_include?('bar foo') }
|
||||||
|
tmux.send_keys :Enter
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module TestShell
|
module TestShell
|
||||||
|
Loading…
x
Reference in New Issue
Block a user