Skip to content

Commit

Permalink
new line on enter
Browse files Browse the repository at this point in the history
  • Loading branch information
Kacperacy committed Mar 15, 2024
1 parent 269f59c commit 8b4ae95
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ impl Editor {
self.move_cursor(c);
} else if c.code == KeyCode::Backspace {
self.delete_char();
} else if c.code == KeyCode::Enter {
self.rows.insert(self.cursor.y, String::new());
self.cursor.x = 0;
self.cursor.y += 1;
} else if let KeyCode::Char(c) = c.code {
self.insert_char(c);
}
Expand Down

0 comments on commit 8b4ae95

Please sign in to comment.