Support LeftInLine and RightInLine motions
This commit is contained in:
parent
b3c5f14e47
commit
e942e649ed
1 changed files with 17 additions and 0 deletions
|
|
@ -360,6 +360,14 @@ impl<'a> Edit for ViEditor<'a> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Motion::Left => Action::Left,
|
Motion::Left => Action::Left,
|
||||||
|
Motion::LeftInLine => {
|
||||||
|
let cursor = editor.cursor();
|
||||||
|
if cursor.index > 0 {
|
||||||
|
Action::Left
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
Motion::Line => {
|
Motion::Line => {
|
||||||
//TODO: what to do for this psuedo-motion?
|
//TODO: what to do for this psuedo-motion?
|
||||||
return;
|
return;
|
||||||
|
|
@ -570,6 +578,15 @@ impl<'a> Edit for ViEditor<'a> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Motion::Right => Action::Right,
|
Motion::Right => Action::Right,
|
||||||
|
Motion::RightInLine => {
|
||||||
|
let cursor = editor.cursor();
|
||||||
|
let buffer = editor.buffer();
|
||||||
|
if cursor.index < buffer.lines[cursor.line].text().len() {
|
||||||
|
Action::Right
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
Motion::ScreenHigh => {
|
Motion::ScreenHigh => {
|
||||||
//TODO: is this efficient?
|
//TODO: is this efficient?
|
||||||
if let Some(first) = editor.buffer().layout_runs().next() {
|
if let Some(first) = editor.buffer().layout_runs().next() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue