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,23 +511,25 @@ impl<'a> TextBuffer<'a> {
|
||||||
let end_glyph = if end.line == line_i_scrolled {
|
let end_glyph = if end.line == line_i_scrolled {
|
||||||
end.glyph
|
end.glyph
|
||||||
} else {
|
} else {
|
||||||
line.glyphs.len()
|
line.glyphs.len() + 1
|
||||||
};
|
};
|
||||||
|
|
||||||
let start_x = line.glyphs.get(start_glyph).map_or(0, |glyph| {
|
if end_glyph > start_glyph {
|
||||||
glyph.x as i32
|
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| {
|
});
|
||||||
(glyph.x + glyph.w) as i32
|
let end_x = line.glyphs.get(end_glyph - 1).map_or(self.width, |glyph| {
|
||||||
});
|
(glyph.x + glyph.w) as i32
|
||||||
|
});
|
||||||
|
|
||||||
f(
|
f(
|
||||||
start_x,
|
start_x,
|
||||||
line_y - font_size,
|
line_y - font_size,
|
||||||
cmp::max(0, end_x - start_x) as u32,
|
cmp::max(0, end_x - start_x) as u32,
|
||||||
line_height as u32,
|
line_height as u32,
|
||||||
0x33_00_00_00 | (color & 0xFF_FF_FF)
|
0x33_00_00_00 | (color & 0xFF_FF_FF)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue