on master help sign in
Merge pull request #70 from RLHerbert/master
3c77299Blaž Hrastnik
helix-view/src/view.rs+3−2
@@ -143,8 +143,9 @@ impl View {
143 }
143 }
144 }
144 }
145
145
146+ // It is possible for underflow to occur if the buffer length is larger than the terminal width.
146− let row = line - self.first_line as usize;
147+ let row = line.saturating_sub(self.first_line);
147− let col = col - self.first_col as usize;
148+ let col = col.saturating_sub(self.first_col);
148
149
149 Some(Position::new(row, col))
150 Some(Position::new(row, col))
150 }
151 }