fixed some bugs in c versiosn

This commit is contained in:
FantasyPvP
2024-11-05 09:32:36 +00:00
parent 83a71ae0a1
commit b40ecc5bb1
9 changed files with 136 additions and 76 deletions
+19 -2
View File
@@ -24,7 +24,7 @@ int open_editor() {
move(0, 0);
Editor editor = new_editor();
Editor editor = editor_from("this is some text to edit\nthis is the second line\nand this is the third lol");
while (true) {
refresh();
@@ -35,10 +35,26 @@ int open_editor() {
editor.editmode = false;
break;
case KEY_BACKSPACE:
delchar(&editor);
move_cursor(&editor, -1, 0);
break;
case KEY_DC:
delchar(&editor);
break;
case KEY_ENTER:
editor.editmode = false;
//TODO: next line
break;
case KEY_UP:
move_cursor(&editor, 0, -1);
break;
case KEY_DOWN:
move_cursor(&editor, 0, 1);
break;
case KEY_LEFT:
move_cursor(&editor, -1, 0);
break;
case KEY_RIGHT:
move_cursor(&editor, 1, 0);
break;
default:
addchar(&editor, c);
@@ -47,6 +63,7 @@ int open_editor() {
} else {
switch (c) {
case 'q':
endwin();
return 0;
case 'i':
editor.editmode = true;