thing-tui: clamp a cursor move below crossterm's overflow
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
91a466192d
commit
2ca326293c
1 changed files with 2 additions and 1 deletions
|
|
@ -94,8 +94,9 @@ impl<W: Write> Drop for Terminal<W> {
|
|||
}
|
||||
}
|
||||
|
||||
/// crossterm adds one to a coordinate to make it 1-based, so the last it can write is `u16::MAX - 1`.
|
||||
fn clamp(n: usize) -> u16 {
|
||||
u16::try_from(n).unwrap_or(u16::MAX)
|
||||
u16::try_from(n).unwrap_or(u16::MAX).min(u16::MAX - 1)
|
||||
}
|
||||
|
||||
/// Paint already composited alpha; `None` is the terminal's own colour.
|
||||
|
|
|
|||
Loading…
Reference in a new issue