summaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorDmitry Sharshakov2021-08-24 05:54:32 +0000
committerDmitry Sharshakov2021-08-24 05:54:32 +0000
commitc4085b4e8885a32a7b05529fe873d38d185ce886 (patch)
tree37718c346f8bd5b02b1461178954f563eeed552c /helix-term
parent5d3c69d5650d4e23eb9922e64bfe31ecdb9feacc (diff)
Use saturating_sub for lenght
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/application.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index f9789d79..72f3a125 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -325,7 +325,7 @@ impl Application {
let (view, doc) = current!(self.editor);
- let text_end = doc.text().len_chars() - 1;
+ let text_end = doc.text().len_chars().saturating_sub(1);
let start = doc.text().try_line_to_char(line - 1).unwrap_or(0) + column;
if let Some(end_line) = end_line {
let end = doc.text().try_line_to_char(end_line - 1).unwrap_or(0)