-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support ANSI Escape Sequence Select Graphic Rendition (#163)
* update go.mod * support Select Graphic Rendition * add fuzzing for preview window * add tests related to SGR * use Go 1.19
- Loading branch information
Showing
18 changed files
with
289 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package fuzzyfinder_test | ||
|
||
import ( | ||
"errors" | ||
"testing" | ||
|
||
"github.com/gdamore/tcell/v2" | ||
fuzzyfinder "github.com/ktr0731/go-fuzzyfinder" | ||
) | ||
|
||
func FuzzPreviewWindow(f *testing.F) { | ||
slice := []string{"foo"} | ||
|
||
f.Add("Lorem ipsum dolor sit amet, consectetur adipiscing elit") | ||
f.Add("Sed eget dui libero.\nVivamus tempus, magna nec mollis convallis, ipsum justo tincidunt ligula, ut varius est mi id nisl.\nMorbi commodo turpis risus, nec vehicula leo auctor sit amet.\nUt imperdiet suscipit massa ac vehicula.\nInterdum et malesuada fames ac ante ipsum primis in faucibus.\nPraesent ligula orci, facilisis pulvinar varius eget, iaculis in erat.\nProin pellentesque arcu sed nisl consectetur tristique.\nQuisque tempus blandit dignissim.\nPhasellus dignissim sollicitudin mauris, sed gravida arcu luctus tincidunt.\nNunc rhoncus sed eros vel molestie.\nAenean sodales tortor eu libero rutrum, et lobortis orci scelerisque.\nPraesent sollicitudin, nunc ut consequat commodo, risus velit consectetur nibh, quis pretium nunc elit et erat.") | ||
f.Add("foo\x1b[31;1;44;0;90;105;38;5;12;48;5;226;38;2;10;20;30;48;2;200;100;50mbar") | ||
|
||
f.Fuzz(func(t *testing.T, s string) { | ||
finder, term := fuzzyfinder.NewWithMockedTerminal() | ||
events := []tcell.Event{key(input{tcell.KeyEsc, rune(tcell.KeyEsc), tcell.ModNone})} | ||
term.SetEventsV2(events...) | ||
|
||
_, err := finder.Find( | ||
slice, | ||
func(int) string { return slice[0] }, | ||
fuzzyfinder.WithPreviewWindow(func(i, width, height int) string { return s }), | ||
) | ||
if !errors.Is(err, fuzzyfinder.ErrAbort) { | ||
t.Fatalf("Find must return ErrAbort, but got '%s'", err) | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
//go:build fuzz | ||
// +build fuzz | ||
|
||
package fuzzyfinder_test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.