Fix horizontal scrolling to start of empty line
This commit is contained in:
parent
cb9d405c20
commit
b0a70c70ff
1 changed files with 12 additions and 11 deletions
|
|
@ -378,7 +378,7 @@ impl Buffer {
|
||||||
if let Some(layout_cursor) = self.layout_cursor(font_system, cursor) {
|
if let Some(layout_cursor) = self.layout_cursor(font_system, cursor) {
|
||||||
if let Some(layout_lines) = self.line_layout(font_system, layout_cursor.line) {
|
if let Some(layout_lines) = self.line_layout(font_system, layout_cursor.line) {
|
||||||
if let Some(layout_line) = layout_lines.get(layout_cursor.layout) {
|
if let Some(layout_line) = layout_lines.get(layout_cursor.layout) {
|
||||||
if let Some(glyph) = layout_line
|
let (x_min, x_max) = if let Some(glyph) = layout_line
|
||||||
.glyphs
|
.glyphs
|
||||||
.get(layout_cursor.glyph)
|
.get(layout_cursor.glyph)
|
||||||
.or_else(|| layout_line.glyphs.last())
|
.or_else(|| layout_line.glyphs.last())
|
||||||
|
|
@ -386,16 +386,17 @@ impl Buffer {
|
||||||
//TODO: use code from cursor_glyph_opt?
|
//TODO: use code from cursor_glyph_opt?
|
||||||
let x_a = glyph.x;
|
let x_a = glyph.x;
|
||||||
let x_b = glyph.x + glyph.w;
|
let x_b = glyph.x + glyph.w;
|
||||||
let x_min = x_a.min(x_b);
|
(x_a.min(x_b), x_a.max(x_b))
|
||||||
let x_max = x_a.max(x_b);
|
} else {
|
||||||
if x_min < self.scroll.horizontal {
|
(0.0, 0.0)
|
||||||
self.scroll.horizontal = x_min;
|
};
|
||||||
self.redraw = true;
|
if x_min < self.scroll.horizontal {
|
||||||
}
|
self.scroll.horizontal = x_min;
|
||||||
if x_max > self.scroll.horizontal + self.width {
|
self.redraw = true;
|
||||||
self.scroll.horizontal = x_max - self.width;
|
}
|
||||||
self.redraw = true;
|
if x_max > self.scroll.horizontal + self.width {
|
||||||
}
|
self.scroll.horizontal = x_max - self.width;
|
||||||
|
self.redraw = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue