aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src/search.rs
diff options
context:
space:
mode:
authorahkrr2021-06-06 19:32:14 +0000
committerBlaž Hrastnik2021-06-07 00:15:08 +0000
commite2d780f993201a79261bc6bd869c8b4f1dc410ce (patch)
tree1c301dda35dc5148ba4e41dffab9499d8ea047e6 /helix-core/src/search.rs
parent843c2cdebd50cfe066c88571eb754c465cda2f60 (diff)
fix: 2 panics while setting style + off by 1
The panics would occur because set_style would draw outside of the the surface. Both occured using `find_prev` or `till_prev` In my case the first panic! would appear in a terminal with around 80 columns in helix/README.md going to the end of the file with `geglf(` the second with `geglfX` The off by one fix ensures that `find_nth_prev` starts at the first character to the left
Diffstat (limited to 'helix-core/src/search.rs')
-rw-r--r--helix-core/src/search.rs1
1 files changed, 0 insertions, 1 deletions
diff --git a/helix-core/src/search.rs b/helix-core/src/search.rs
index 7dd2f4fc..73be68c7 100644
--- a/helix-core/src/search.rs
+++ b/helix-core/src/search.rs
@@ -41,7 +41,6 @@ pub fn find_nth_prev(
inclusive: bool,
) -> Option<usize> {
// start searching right before pos
- pos = pos.saturating_sub(1);
let mut chars = text.chars_at(pos);
for _ in 0..n {