fix: mascot animation, makes syntax highlighting blink
This commit is contained in:
@@ -25,7 +25,7 @@ func TestTerminalCursorOutputPositionsHardwareBarAfterFrame(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
wantSuffix := ansi.SetCursorStyle(5) + ansi.CursorPosition(7, 4) + ansi.ShowCursor
|
||||
if !strings.HasSuffix(string(content), wantSuffix) {
|
||||
if !strings.HasSuffix(string(content), wantSuffix+ansi.ResetSynchronizedOutputMode) {
|
||||
t.Fatalf("cursor output = %q, want suffix %q", content, wantSuffix)
|
||||
}
|
||||
}
|
||||
@@ -46,7 +46,33 @@ func TestTerminalCursorOutputHidesCursorOutsideInsertMode(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !strings.HasSuffix(string(content), ansi.HideCursor) {
|
||||
if !strings.HasSuffix(
|
||||
string(content),
|
||||
ansi.HideCursor+ansi.ResetSynchronizedOutputMode,
|
||||
) {
|
||||
t.Fatalf("cursor output did not hide cursor: %q", content)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTerminalCursorOutputSynchronizesCompletedFrames(t *testing.T) {
|
||||
file, err := os.CreateTemp(t.TempDir(), "cursor-output")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
output := newTerminalCursorOutput(file)
|
||||
output.SetCursor(false, 0, 0)
|
||||
if _, err := output.Write([]byte("animated frame")); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
content, err := os.ReadFile(file.Name())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
want := ansi.SetSynchronizedOutputMode + "animated frame" +
|
||||
ansi.HideCursor + ansi.ResetSynchronizedOutputMode
|
||||
if string(content) != want {
|
||||
t.Fatalf("synchronized frame output = %q, want %q", content, want)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user