Skip to content

Commit

Permalink
fix r
Browse files Browse the repository at this point in the history
  • Loading branch information
hatoo committed Feb 3, 2020
1 parent e557177 commit 2e08cf2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,17 +322,20 @@ impl<B: buffer::CoreBuffer> Core<B> {
}

pub fn replace(&mut self, c: char) {
self.perform(operation::DeleteRange::new(self.cursor..=self.cursor));
self.delete();
self.perform(operation::InsertChar {
cursor: self.cursor,
c,
});
}

pub fn delete(&mut self) {
pub fn delete(&mut self) -> bool {
if self.cursor != self.core_buffer.end_cursor() {
let op = operation::DeleteRange::new(self.cursor..=self.cursor);
self.perform(op);
true
} else {
false
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,15 @@ impl<B: CoreBuffer> Mode<B> for Normal {
});
// TODO bulk delete
for _ in 0..buf.core.len_current_line() {
buf.core.delete()
buf.core.delete();
}
buf.indent();
return Transition::RecordMacro(Box::new(Insert::default()));
}
Event::Key(Key::Char('C')) => {
// TODO bulk delete
while buf.core.char_at_cursor().is_some() {
buf.core.delete()
buf.core.delete();
}
return Transition::RecordMacro(Box::new(Insert::default()));
}
Expand Down

0 comments on commit 2e08cf2

Please sign in to comment.