Fix parsing bugs and add better indentation support

This commit is contained in:
2026-02-01 20:40:52 +00:00
parent f77caf604f
commit 8b93b955e8
17 changed files with 304 additions and 103 deletions

View File

@@ -153,8 +153,7 @@ void handle_editor_event(Editor *editor, KeyEvent event) {
if (event.key_type == KEY_CHAR) {
if (event.len == 1) {
if (event.c[0] == '\t') {
edit_insert(editor, editor->cursor, (char *)" ", 2);
cursor_right(editor, 2);
editor->indents.insert_tab(editor->cursor);
} else if (event.c[0] == '\n' || event.c[0] == '\r') {
editor->indents.insert_new_line(editor->cursor);
} else if (event.c[0] == CTRL('W')) {
@@ -205,6 +204,14 @@ void handle_editor_event(Editor *editor, KeyEvent event) {
paste(editor);
mode = NORMAL;
break;
case '<':
case ',':
dedent_selection(editor);
break;
case '>':
case '.':
indent_selection(editor);
break;
}
}
break;