View mode: Use saturating_sub when calculating first_col

pull/157/head
Blaž Hrastnik 3 years ago
parent 01b1bd15a1
commit 4f561e93b8

@ -2502,7 +2502,7 @@ pub fn view_mode(cx: &mut Context) {
let pos = coords_at_pos(doc.text().slice(..), pos);
const OFFSET: usize = 7; // gutters
view.first_col = pos.col.saturating_sub((view.area.width as usize - OFFSET) / 2);
view.first_col = pos.col.saturating_sub(((view.area.width as usize).saturating_sub(OFFSET)) / 2);
},
'h' => (),
'j' => scroll(cx, 1, Direction::Forward),

Loading…
Cancel
Save