aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorahkrr2021-06-05 14:32:23 +0000
committerBlaž Hrastnik2021-06-05 15:01:16 +0000
commitc5c3ec07f4089d831c88b3edd58bc2b6e8872a72 (patch)
tree389d9743bbf7fe73711a5579c6cc49d8860479f8 /helix-term/src
parent444cd0b068f5a838caeeb7aa9c2d570fa330ce97 (diff)
fix: panicked at 'attempt to subtract with overflow'
helix-term/src/ui/editor.rs:275:29 This would happen when the window-size was to small to display the entire width and one would start jumping forwards with f<some_char> and the beginning of the highlighted area would end up outside of the window
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/ui/editor.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index 6c39088e..2464528c 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -272,7 +272,7 @@ impl EditorView {
viewport.x + start.col as u16,
viewport.y + start.row as u16,
// text.line(view.first_line).len_chars() as u16 - start.col as u16,
- viewport.width - start.col as u16,
+ viewport.width.saturating_sub(start.col as u16),
1,
),
selection_style,