From 4f561e93b8cff364196475a97fb2bfefcd1c7092 Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Mon, 7 Jun 2021 09:29:21 +0900 Subject: View mode: Use saturating_sub when calculating first_col --- helix-term/src/commands.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'helix-term/src') 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), -- cgit v1.2.3-70-g09d2