Commit e139f12f authored by Jeremy Soller's avatar Jeremy Soller Committed by GitHub

Merge pull request #75 from dummie999/master

Implement 'I', 'A' and 'c' commands.
parents 5034fdcd b527512b
......@@ -49,6 +49,14 @@ impl Editor {
mode: InsertMode::Insert,
}));
}
(Command(Normal), Char('I')) => {
self.cursor_mut().x = 0;
self.cursor_mut().mode =
Mode::Primitive(PrimitiveMode::Insert(InsertOptions {
mode: InsertMode::Insert,
}));
}
(Command(Normal), Char('a')) => {
let pos = self.right(1, false);
......@@ -57,7 +65,15 @@ impl Editor {
Mode::Primitive(PrimitiveMode::Insert(InsertOptions {
mode: InsertMode::Insert,
}));
}
(Command(Normal), Char('A')) => {
let pos = (self.buffers.current_buffer()[self.y()].len(), self.y());
//let pos = self.right(1, false);
self.goto(pos);
self.cursor_mut().mode =
Mode::Primitive(PrimitiveMode::Insert(InsertOptions {
mode: InsertMode::Insert,
}));
}
(Command(Normal), Char('o')) => {
let y = self.y();
......@@ -118,7 +134,7 @@ impl Editor {
self.goto(bounded);
}
(Command(Normal), Char('L')) => {
let ln_end = (self.buffers.current_buffer()[self.y()].len(), self.y());
let ln_end = (self.buffers.current_buffer()[self.y()].len() - 1, self.y());
self.goto(ln_end);
mov = true;
}
......@@ -149,6 +165,16 @@ impl Editor {
self.remove_rb(m);
}
}
(Command(Normal), Char('c')) => {
let ins = self.get_inst();
if let Some(m) = self.to_motion_unbounded(ins) {
self.remove_rb(m);
self.cursor_mut().mode =
Mode::Primitive(PrimitiveMode::Insert(InsertOptions {
mode: InsertMode::Insert,
}));
}
}
(Command(Normal), Char('G')) => {
let last = self.buffers.current_buffer().len() - 1;
self.goto((0, last));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment