Make Motion::Home and Motion::End operate on unwrapped lines, fixes #468
This commit is contained in:
parent
d7dc22dd20
commit
82fadd954c
1 changed files with 3 additions and 22 deletions
|
|
@ -1173,17 +1173,7 @@ impl Buffer {
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Motion::Home => {
|
Motion::Home => {
|
||||||
let mut layout_cursor = self.layout_cursor(font_system, cursor)?;
|
cursor.index = 0;
|
||||||
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_x_opt = None;
|
cursor_x_opt = None;
|
||||||
}
|
}
|
||||||
Motion::SoftHome => {
|
Motion::SoftHome => {
|
||||||
|
|
@ -1196,17 +1186,8 @@ impl Buffer {
|
||||||
cursor_x_opt = None;
|
cursor_x_opt = None;
|
||||||
}
|
}
|
||||||
Motion::End => {
|
Motion::End => {
|
||||||
let mut layout_cursor = self.layout_cursor(font_system, cursor)?;
|
let line = self.lines.get(cursor.line)?;
|
||||||
layout_cursor.glyph = usize::MAX;
|
cursor.index = line.text().len();
|
||||||
#[allow(unused_assignments)]
|
|
||||||
{
|
|
||||||
(cursor, cursor_x_opt) = self.cursor_motion(
|
|
||||||
font_system,
|
|
||||||
cursor,
|
|
||||||
cursor_x_opt,
|
|
||||||
Motion::LayoutCursor(layout_cursor),
|
|
||||||
)?;
|
|
||||||
}
|
|
||||||
cursor_x_opt = None;
|
cursor_x_opt = None;
|
||||||
}
|
}
|
||||||
Motion::ParagraphStart => {
|
Motion::ParagraphStart => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue