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
This commit is contained in:
ahkrr 2021-06-05 16:32:23 +02:00 committed by Blaž Hrastnik
parent 444cd0b068
commit c5c3ec07f4

View file

@ -272,7 +272,7 @@ impl EditorView {
viewport.x + start.col as u16, viewport.x + start.col as u16,
viewport.y + start.row as u16, viewport.y + start.row as u16,
// text.line(view.first_line).len_chars() as u16 - start.col 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, 1,
), ),
selection_style, selection_style,