Fix selection when start and end lines match
This commit is contained in:
parent
da5b69b2bb
commit
eacd09b167
1 changed files with 10 additions and 4 deletions
|
|
@ -679,7 +679,15 @@ impl<'a> TextBuffer<'a> {
|
||||||
// In between start and end lines, definitely inside selection
|
// In between start and end lines, definitely inside selection
|
||||||
inside = true;
|
inside = true;
|
||||||
} else {
|
} 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
|
// On edge of start line, check if any contained glyphs are after start
|
||||||
for glyph in layout_line.glyphs.iter() {
|
for glyph in layout_line.glyphs.iter() {
|
||||||
if glyph.start >= start.start {
|
if glyph.start >= start.start {
|
||||||
|
|
@ -687,9 +695,7 @@ impl<'a> TextBuffer<'a> {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if line_i == end.line.get() {
|
||||||
|
|
||||||
if line_i == end.line.get() && !inside {
|
|
||||||
// On edge of end line, check if any contained glyphs are before end
|
// On edge of end line, check if any contained glyphs are before end
|
||||||
for glyph in layout_line.glyphs.iter() {
|
for glyph in layout_line.glyphs.iter() {
|
||||||
if glyph.end <= end.end {
|
if glyph.end <= end.end {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue