What's wrong
SpectreConsoleProvider.SetCursorPosition (TUI/Services/SpectreConsoleProvider.cs:101-108) does nothing when the position is outside Dimensions. WriteAt (:50-66) ignores that and writes the text anyway:
SetCursorPosition(position); // no-op when off-screen
...
_console.Write(text); // still written, at whatever cursor position was left behind
Repro (executed)
On a 10×5 console:
provider.WriteAt("AB", new Position(2, 1));
provider.WriteAt("XYZ", new Position(3, 7)); // y=7 is off-screen
- Actual output:
ESC[1;2HABXYZ. "XYZ" is drawn right after "AB".
- Expected: "XYZ" is not drawn at all.
Why it matters
Layout regularly produces positions past the screen edge. Examples are a TextElement with Right or Center alignment whose start lands at or past the width, children of a container that has shrunk, and content scrolled off-screen. Each of these leaks text onto an unrelated part of the screen, and the result depends on draw order. Text that starts on-screen but runs past the right edge also isn't clipped, so it wraps onto the next line.
Suggested fix / acceptance criteria
WriteAt returns without writing when position.Y is outside [0, Height) or the text lies entirely outside [0, Width).
- Text that is partly visible is clipped to the columns that fit, including a negative start X.
- Add tests for off-screen rows, a negative X, and text overflowing the right edge.
What's wrong
SpectreConsoleProvider.SetCursorPosition(TUI/Services/SpectreConsoleProvider.cs:101-108) does nothing when the position is outsideDimensions.WriteAt(:50-66) ignores that and writes the text anyway:Repro (executed)
On a 10×5 console:
ESC[1;2HABXYZ. "XYZ" is drawn right after "AB".Why it matters
Layout regularly produces positions past the screen edge. Examples are a
TextElementwith Right or Center alignment whose start lands at or past the width, children of a container that has shrunk, and content scrolled off-screen. Each of these leaks text onto an unrelated part of the screen, and the result depends on draw order. Text that starts on-screen but runs past the right edge also isn't clipped, so it wraps onto the next line.Suggested fix / acceptance criteria
WriteAtreturns without writing whenposition.Yis outside[0, Height)or the text lies entirely outside[0, Width).