|
|
@ -368,7 +368,6 @@ pub fn open_below(view: &mut View, _count: usize) {
|
|
|
|
let transaction = Transaction::change(&view.state, changes).with_selection(selection);
|
|
|
|
let transaction = Transaction::change(&view.state, changes).with_selection(selection);
|
|
|
|
|
|
|
|
|
|
|
|
transaction.apply(&mut view.state);
|
|
|
|
transaction.apply(&mut view.state);
|
|
|
|
// TODO: need to store into history if successful
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// O inserts a new line before each line with a selection
|
|
|
|
// O inserts a new line before each line with a selection
|
|
|
@ -420,13 +419,15 @@ pub fn goto_mode(view: &mut View, _count: usize) {
|
|
|
|
view.state.mode = Mode::Goto;
|
|
|
|
view.state.mode = Mode::Goto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// NOTE: Transactions in this module get appended to history when we switch back to normal mode.
|
|
|
|
|
|
|
|
pub mod insert {
|
|
|
|
|
|
|
|
use super::*;
|
|
|
|
// TODO: insert means add text just before cursor, on exit we should be on the last letter.
|
|
|
|
// TODO: insert means add text just before cursor, on exit we should be on the last letter.
|
|
|
|
pub fn insert_char(view: &mut View, c: char) {
|
|
|
|
pub fn insert_char(view: &mut View, c: char) {
|
|
|
|
let c = Tendril::from_char(c);
|
|
|
|
let c = Tendril::from_char(c);
|
|
|
|
let transaction = Transaction::insert(&view.state, c);
|
|
|
|
let transaction = Transaction::insert(&view.state, c);
|
|
|
|
|
|
|
|
|
|
|
|
transaction.apply(&mut view.state);
|
|
|
|
transaction.apply(&mut view.state);
|
|
|
|
// TODO: need to store into history if successful
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn insert_tab(view: &mut View, _count: usize) {
|
|
|
|
pub fn insert_tab(view: &mut View, _count: usize) {
|
|
|
@ -448,7 +449,6 @@ pub fn delete_char_backward(view: &mut View, count: usize) {
|
|
|
|
)
|
|
|
|
)
|
|
|
|
});
|
|
|
|
});
|
|
|
|
transaction.apply(&mut view.state);
|
|
|
|
transaction.apply(&mut view.state);
|
|
|
|
// TODO: need to store into history if successful
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn delete_char_forward(view: &mut View, count: usize) {
|
|
|
|
pub fn delete_char_forward(view: &mut View, count: usize) {
|
|
|
@ -461,7 +461,7 @@ pub fn delete_char_forward(view: &mut View, count: usize) {
|
|
|
|
)
|
|
|
|
)
|
|
|
|
});
|
|
|
|
});
|
|
|
|
transaction.apply(&mut view.state);
|
|
|
|
transaction.apply(&mut view.state);
|
|
|
|
// TODO: need to store into history if successful
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Undo / Redo
|
|
|
|
// Undo / Redo
|
|
|
|