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
commitc5c3ec07f4089d831c88b3edd58bc2b6e8872a72
authorahkrr <alexhk@protonmail.com>
dateSat 5 Jun 2021, 16:32 (5 years ago)
parent444cd0b
helix-term/src/ui/editor.rs+1−1
@@ -272,7 +272,7 @@ impl EditorView {
272272 viewport.x + start.col as u16,
273273 viewport.y + start.row as u16,
274274 // text.line(view.first_line).len_chars() as u16 - start.col as u16,
275− viewport.width - start.col as u16,
275+ viewport.width.saturating_sub(start.col as u16),
276276 1,
277277 ),
278278 selection_style,