small software-rendered rust tty
saturate
bendn 8 months ago
parent a4b4ddb · commit 18dbeaa
-rw-r--r--src/term.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/term.rs b/src/term.rs
index 65d9ee5..9dd0ee4 100644
--- a/src/term.rs
+++ b/src/term.rs
@@ -172,7 +172,8 @@ impl Terminal {
end: b'D',
..
}) => {
- self.cursor.0 -= p.value_or(1);
+ self.cursor.0 =
+ (self.cursor.0.saturating_sub(p.value_or(1))).max(1);
}
Control(ControlFunction {
start: b'[',