diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2024-11-29 00:26:12 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2024-11-29 00:26:12 +0900 |
| commit | 3b0c86e4013abb66f36108aedad4ef81fe2a06e2 (patch) | |
| tree | a1b7b1738d39f1c1242332dd801b5a379704f530 /src/terminal_test.go | |
| parent | 61d10d8ffafa3e3dd80886bd46f24139f8265880 (diff) | |
| download | fzf-3b0c86e4013abb66f36108aedad4ef81fe2a06e2.tar.gz | |
Much faster image processing
Fix #3984
Diffstat (limited to 'src/terminal_test.go')
| -rw-r--r-- | src/terminal_test.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/terminal_test.go b/src/terminal_test.go index 317cd5f9..44da2bcf 100644 --- a/src/terminal_test.go +++ b/src/terminal_test.go @@ -507,6 +507,34 @@ func TestParsePlaceholder(t *testing.T) { } } +func TestExtractPassthroughs(t *testing.T) { + for _, middle := range []string{ + "\x1bPtmux;\x1b\x1bbar\x1b\\", + "\x1bPtmux;\x1b\x1bbar\x1bbar\x1b\\", + "\x1b]1337;bar\x1b\\", + "\x1b]1337;bar\x1bbar\x1b\\", + "\x1b]1337;bar\a", + "\x1b_Ga=T,f=32,s=1258,v=1295,c=74,r=35,m=1\x1b\\", + "\x1b_Ga=T,f=32,s=1258,v=1295,c=74,r=35,m=1\x1b\\\r", + "\x1b_Ga=T,f=32,s=1258,v=1295,c=74,r=35,m=1\x1bbar\x1b\\\r", + "\x1b_Gm=1;AAAAAAAAA=\x1b\\", + "\x1b_Gm=1;AAAAAAAAA=\x1b\\\r", + "\x1b_Gm=1;\x1bAAAAAAAAA=\x1b\\\r", + } { + line := "foo" + middle + "baz" + loc := findPassThrough(line) + if loc == nil || line[0:loc[0]] != "foo" || line[loc[1]:] != "baz" { + t.Error("failed to find passthrough") + } + garbage := "\x1bPtmux;\x1b]1337;\x1b_Ga=\x1b]1337;bar\x1b." + line = strings.Repeat("foo"+middle+middle+"baz", 3) + garbage + passthroughs, result := extractPassThroughs(line) + if result != "foobazfoobazfoobaz"+garbage || len(passthroughs) != 6 { + t.Error("failed to extract passthroughs") + } + } +} + /* utilities section */ // Item represents one line in fzf UI. Usually it is relative path to files and folders. |
