aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Vegdahl2021-06-26 04:41:54 +0000
committerBlaž Hrastnik2021-06-26 05:26:18 +0000
commita6cadddef4b43659ad3faedac455f32f6019025d (patch)
treed6c0c670845b2fc72d13e622cf749be48394e5a5
parent2dba228c766e5e9e4b0fe0c12d30909f51faa28e (diff)
Fix silly mistake in previous phantom line bug fix.
Fixes #381. I was trying to change an index value that... wasn't even an index value.
-rw-r--r--helix-core/src/graphemes.rs14
-rw-r--r--helix-term/src/ui/editor.rs3
2 files changed, 1 insertions, 16 deletions
diff --git a/helix-core/src/graphemes.rs b/helix-core/src/graphemes.rs
index e2f7c3f3..f71b6d5f 100644
--- a/helix-core/src/graphemes.rs
+++ b/helix-core/src/graphemes.rs
@@ -131,20 +131,6 @@ pub fn ensure_grapheme_boundary(slice: RopeSlice, char_idx: usize) -> usize {
}
}
-/// Returns the passed byte index if it's already a grapheme boundary,
-/// or the next grapheme boundary byte index if not.
-pub fn ensure_grapheme_boundary_byte(slice: RopeSlice, byte_idx: usize) -> usize {
- // TODO: we can avoid the byte/char conversions entirely
- // if we also make byte versions of the other functions.
- let char_idx = slice.byte_to_char(byte_idx);
- let fixed_char_idx = ensure_grapheme_boundary(slice, char_idx);
- if fixed_char_idx == char_idx {
- byte_idx
- } else {
- slice.char_to_byte(fixed_char_idx)
- }
-}
-
/// Returns whether the given char position is a grapheme boundary.
pub fn is_grapheme_boundary(slice: RopeSlice, char_idx: usize) -> bool {
// Bounds check
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index 14cfc7dd..78cca5c7 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -8,7 +8,7 @@ use crate::{
use helix_core::{
coords_at_pos,
- graphemes::{ensure_grapheme_boundary, ensure_grapheme_boundary_byte},
+ graphemes::ensure_grapheme_boundary,
syntax::{self, HighlightEvent},
LineEnding, Position, Range,
};
@@ -143,7 +143,6 @@ impl EditorView {
'outer: for event in highlights {
match event.unwrap() {
HighlightEvent::HighlightStart(mut span) => {
- span.0 = ensure_grapheme_boundary_byte(text, span.0);
spans.push(span);
}
HighlightEvent::HighlightEnd => {