diff --git a/src/buffer.rs b/src/buffer.rs index 282989b..2fb0168 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -1173,17 +1173,7 @@ impl Buffer { )?; } Motion::Home => { - let mut layout_cursor = self.layout_cursor(font_system, cursor)?; - layout_cursor.glyph = 0; - #[allow(unused_assignments)] - { - (cursor, cursor_x_opt) = self.cursor_motion( - font_system, - cursor, - cursor_x_opt, - Motion::LayoutCursor(layout_cursor), - )?; - } + cursor.index = 0; cursor_x_opt = None; } Motion::SoftHome => { @@ -1196,17 +1186,8 @@ impl Buffer { cursor_x_opt = None; } Motion::End => { - let mut layout_cursor = self.layout_cursor(font_system, cursor)?; - layout_cursor.glyph = usize::MAX; - #[allow(unused_assignments)] - { - (cursor, cursor_x_opt) = self.cursor_motion( - font_system, - cursor, - cursor_x_opt, - Motion::LayoutCursor(layout_cursor), - )?; - } + let line = self.lines.get(cursor.line)?; + cursor.index = line.text().len(); cursor_x_opt = None; } Motion::ParagraphStart => {