Fix selection when start and end lines match

This commit is contained in:
Jeremy Soller 2022-10-21 11:27:21 -06:00
parent da5b69b2bb
commit eacd09b167
No known key found for this signature in database
GPG key ID: 87F211AF2BE4C2FE

View file

@ -679,7 +679,15 @@ impl<'a> TextBuffer<'a> {
// In between start and end lines, definitely inside selection
inside = true;
} else {
if line_i == start.line.get() {
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.start && glyph.end <= end.end{
inside = true;
break;
}
}
} 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.start {
@ -687,9 +695,7 @@ impl<'a> TextBuffer<'a> {
break;
}
}
}
if line_i == end.line.get() && !inside {
} 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.end {