on master help sign in
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.

commita6cadddef4b43659ad3faedac455f32f6019025d authorNathan Vegdahl <cessen@cessen.com> dateFri 25 Jun 2021, 21:41 (5 years ago) parent2dba228
2 files changed+1−16
helix-core/src/graphemes.rs−14 helix-term/src/ui/editor.rs+1−2
helix-core/src/graphemes.rs−14
@@ -131,20 +131,6 @@ pub fn ensure_grapheme_boundary(slice: RopeSlice, char_idx: usize) -> usize {
131131 }
132132}
133133
134−/// Returns the passed byte index if it's already a grapheme boundary,
135−/// or the next grapheme boundary byte index if not.
136−pub fn ensure_grapheme_boundary_byte(slice: RopeSlice, byte_idx: usize) -> usize {
137− // TODO: we can avoid the byte/char conversions entirely
138− // if we also make byte versions of the other functions.
139− let char_idx = slice.byte_to_char(byte_idx);
140− let fixed_char_idx = ensure_grapheme_boundary(slice, char_idx);
141− if fixed_char_idx == char_idx {
142− byte_idx
143− } else {
144− slice.char_to_byte(fixed_char_idx)
145− }
146−}
147−
148134/// Returns whether the given char position is a grapheme boundary.
149135pub fn is_grapheme_boundary(slice: RopeSlice, char_idx: usize) -> bool {
150136 // Bounds check
helix-term/src/ui/editor.rs+1−2
@@ -8,7 +8,7 @@ use crate::{
88
99use helix_core::{
1010 coords_at_pos,
11− graphemes::{ensure_grapheme_boundary, ensure_grapheme_boundary_byte},
11+ graphemes::ensure_grapheme_boundary,
1212 syntax::{self, HighlightEvent},
1313 LineEnding, Position, Range,
1414};
@@ -143,7 +143,6 @@ impl EditorView {
143143 'outer: for event in highlights {
144144 match event.unwrap() {
145145 HighlightEvent::HighlightStart(mut span) => {
146− span.0 = ensure_grapheme_boundary_byte(text, span.0);
147146 spans.push(span);
148147 }
149148 HighlightEvent::HighlightEnd => {