Fix off by one with end of selection
This commit is contained in:
parent
190b41f387
commit
66f9fea001
1 changed files with 16 additions and 14 deletions
|
|
@ -511,13 +511,14 @@ impl<'a> TextBuffer<'a> {
|
|||
let end_glyph = if end.line == line_i_scrolled {
|
||||
end.glyph
|
||||
} else {
|
||||
line.glyphs.len()
|
||||
line.glyphs.len() + 1
|
||||
};
|
||||
|
||||
if end_glyph > start_glyph {
|
||||
let start_x = line.glyphs.get(start_glyph).map_or(0, |glyph| {
|
||||
glyph.x as i32
|
||||
});
|
||||
let end_x = line.glyphs.get(end_glyph).map_or(self.width, |glyph| {
|
||||
let end_x = line.glyphs.get(end_glyph - 1).map_or(self.width, |glyph| {
|
||||
(glyph.x + glyph.w) as i32
|
||||
});
|
||||
|
||||
|
|
@ -530,6 +531,7 @@ impl<'a> TextBuffer<'a> {
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Draw cursor
|
||||
if self.cursor.line == line_i_scrolled {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue