Skip to content

Commit

Permalink
Avoid underflow panic
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Sep 4, 2023
1 parent ee630ab commit a9c9660
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/rendering/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl LineCursor {

/// Returns the amount of empty space in the line.
pub const fn space(&self) -> u32 {
self.width - self.position
self.width.saturating_sub(self.position)
}

/// Moves the cursor by a given amount.
Expand Down

0 comments on commit a9c9660

Please sign in to comment.