mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-27 11:16:03 +00:00
Use more elegant saturating_sub
This commit is contained in:
parent
d2f2f642c1
commit
b021458352
@ -99,11 +99,8 @@ impl<'a> Iterator for LinesIterator<'a> {
|
|||||||
let content = &content[..next];
|
let content = &content[..next];
|
||||||
|
|
||||||
let allowed_width = if self.show_spaces {
|
let allowed_width = if self.show_spaces {
|
||||||
if self.width < 1 {
|
// Remove 1 from the available space, if possible.
|
||||||
0
|
self.width.saturating_sub(1)
|
||||||
} else {
|
|
||||||
self.width - 1
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
self.width
|
self.width
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user