Make Motion::Home and Motion::End operate on unwrapped lines, fixes #468

This commit is contained in:
Jeremy Soller 2026-02-18 15:39:41 -07:00
parent d7dc22dd20
commit 82fadd954c

View file

@ -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 => {