From ab56c52c73e73b400f375714435a57ab90bd2dad Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Mon, 24 Oct 2022 14:27:26 -0600 Subject: [PATCH] Improve selection inside ligatures --- Cargo.toml | 1 + src/buffer.rs | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c77a43a..5e70b64 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ sys-locale = "0.2" unicode-bidi = "0.3" unicode-linebreak = "0.1" unicode-script = "0.5" +unicode-segmentation = "1.7" [workspace] members = [ diff --git a/src/buffer.rs b/src/buffer.rs index b319785..f18e635 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -900,7 +900,7 @@ impl<'a> TextBuffer<'a> { if line_i == start.line.get() && line_i == end.line.get() { // On edge of start and end line, check if any contained glyphs are after start and before end for glyph in layout_line.glyphs.iter() { - if glyph.start >= start.index && glyph.end <= end.index { + if glyph.end > start.index && glyph.start < end.index { inside = true; break; } @@ -908,7 +908,7 @@ impl<'a> TextBuffer<'a> { } else if line_i == start.line.get() { // On edge of start line, check if any contained glyphs are after start for glyph in layout_line.glyphs.iter() { - if glyph.start >= start.index { + if glyph.end > start.index { inside = true; break; } @@ -916,7 +916,7 @@ impl<'a> TextBuffer<'a> { } else if line_i == end.line.get() { // On edge of end line, check if any contained glyphs are before end for glyph in layout_line.glyphs.iter() { - if glyph.end <= end.index { + if glyph.start < end.index { inside = true; break; }