From cb9d405c2052e954c25447ccfa0f00ea075b6fa3 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Thu, 30 May 2024 14:33:35 -0600 Subject: [PATCH] Fix horizontal scroll to end of line --- src/buffer.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/buffer.rs b/src/buffer.rs index d5d43c1..586867e 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -378,7 +378,11 @@ impl Buffer { 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_line) = layout_lines.get(layout_cursor.layout) { - if let Some(glyph) = layout_line.glyphs.get(layout_cursor.glyph) { + if let Some(glyph) = layout_line + .glyphs + .get(layout_cursor.glyph) + .or_else(|| layout_line.glyphs.last()) + { //TODO: use code from cursor_glyph_opt? let x_a = glyph.x; let x_b = glyph.x + glyph.w;