Commit 3bb1da3f authored by Jeremy Soller's avatar Jeremy Soller Committed by GitHub

Merge pull request #77 from dummie999/master

Fix freeze on resize screen, impl tab as 4 spaces
parents fcae711a 3bd66c61
......@@ -124,9 +124,11 @@ impl Editor {
self.goto(bounded);
}
(Command(Normal), Char('L')) => {
let ln_end = (self.buffers.current_buffer()[self.y()].len() - 1, self.y());
self.goto(ln_end);
mov = true;
if self.buffers.current_buffer()[self.y()].len() != 0 {
let ln_end = (self.buffers.current_buffer()[self.y()].len() - 1, self.y());
self.goto(ln_end);
mov = true;
}
}
(Command(Normal), Char('H')) => {
self.cursor_mut().x = 0;
......
......@@ -46,6 +46,14 @@ impl Editor {
self.goto((begin, y + 1));
}
(InsertMode::Insert, Key::Backspace) => self.backspace(),
(InsertMode::Insert, Key::Tab) => {
for i in 0..4 {
self.buffers.current_buffer_mut()[y].insert(x + i, ' ');
}
self.redraw_task = RedrawTask::Lines(y..y + 1);
let right = self.right(4, false);
self.goto(right);
}
(InsertMode::Insert, Key::Char(c)) => {
self.buffers.current_buffer_mut()[y].insert(x, c);
......
......@@ -115,6 +115,10 @@ impl Editor {
EventOption::Quit(_) => {
return Inst(Parameter::Null, Cmd { key: Key::Quit });
}
EventOption::Resize(_) => {
self.redraw_task = RedrawTask::Full;
self.redraw();
}
_ => {}
}
}
......
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