Skip to content

Commit

Permalink
View mode: Use saturating_sub when calculating first_col
Browse files Browse the repository at this point in the history
  • Loading branch information
archseer committed Jun 7, 2021
1 parent 01b1bd1 commit 4f561e9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 4f561e9

Please sign in to comment.