mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-16 08:52:50 +08:00
This commit is contained in:
parent
35ce60b596
commit
71a5d83067
@ -49,7 +49,7 @@ internal sealed class LiveRenderable : Renderable
|
|||||||
}
|
}
|
||||||
|
|
||||||
var linesToMoveUp = _shape.Value.Height - 1;
|
var linesToMoveUp = _shape.Value.Height - 1;
|
||||||
return new ControlCode("\r" + CUU(linesToMoveUp));
|
return new ControlCode("\r" + (EL(2) + CUU(1)).Repeat(linesToMoveUp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
[?25l
|
[?25l
|
||||||
[38;5;11m*[0m foo
|
[38;5;11m*[0m foo
|
||||||
|
|
||||||
[2A
|
[2K[1A[2K[1A
|
||||||
[38;5;11m-[0m bar
|
[38;5;11m-[0m bar
|
||||||
|
|
||||||
[2A
|
[2K[1A[2K[1A
|
||||||
[38;5;11m*[0m baz
|
[38;5;11m*[0m baz
|
||||||
|
|
||||||
[2K[1A[2K[1A[2K[?25h
|
[2K[1A[2K[1A[2K[?25h
|
@ -0,0 +1,12 @@
|
|||||||
|
[?25l
|
||||||
|
[38;5;11m⣷[0m long text that should not interfere writeline text
|
||||||
|
|
||||||
|
[2K[1A[2K[1A[38;5;15mxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx[0m
|
||||||
|
[38;5;15mxxxxxxxxxx[0m
|
||||||
|
|
||||||
|
[38;5;11m⣷[0m long text that should not interfere writeline text
|
||||||
|
|
||||||
|
[2K[1A[2K[1A
|
||||||
|
[38;5;11m⣷[0m long text that should not interfere writeline text
|
||||||
|
|
||||||
|
[2K[1A[2K[1A[2K[?25h
|
@ -49,4 +49,30 @@ public sealed class StatusTests
|
|||||||
// Then
|
// Then
|
||||||
return Verifier.Verify(console.Output);
|
return Verifier.Verify(console.Output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
[Expectation("WriteLineOverflow")]
|
||||||
|
public Task Should_Render_Correctly_When_WriteLine_Exceeds_Console_Width()
|
||||||
|
{
|
||||||
|
// Given
|
||||||
|
var console = new TestConsole()
|
||||||
|
.Colors(ColorSystem.TrueColor)
|
||||||
|
.Width(100)
|
||||||
|
.Interactive()
|
||||||
|
.EmitAnsiSequences();
|
||||||
|
var status = new Status(console)
|
||||||
|
{
|
||||||
|
AutoRefresh = false,
|
||||||
|
};
|
||||||
|
|
||||||
|
// When
|
||||||
|
status.Start("long text that should not interfere writeline text", ctx =>
|
||||||
|
{
|
||||||
|
ctx.Refresh();
|
||||||
|
console.WriteLine("x".Repeat(console.Profile.Width + 10), new Style(foreground: Color.White));
|
||||||
|
});
|
||||||
|
|
||||||
|
// Then
|
||||||
|
return Verifier.Verify(console.Output);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user