aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-06-07 00:29:21 +0000
committerBlaž Hrastnik2021-06-07 00:29:21 +0000
commit4f561e93b8cff364196475a97fb2bfefcd1c7092 (patch)
tree1a228ff9fc733c135935d98f4fe5e1a3d96b4689 /helix-term
parent01b1bd15a1536244f9cd9ffd7c29ae9bfca66613 (diff)
View mode: Use saturating_sub when calculating first_col
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/commands.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index f260d3eb..fe334117 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -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),