summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorcflip <cflip@cflip.net>2023-01-08 14:15:01 -0700
committercflip <cflip@cflip.net>2023-01-08 14:15:01 -0700
commit91195d34e1f71246cadc41705004d66ab647087e (patch)
tree0d2f7e929b7b51590d270e2f22fb5a3621204bf2 /main.c
Initial import of existing source code
This is based off of snaptoken's "Build Your Own Text Editor" tutorial at https://viewsourcecode.org/snaptoken/kilo/.
Diffstat (limited to 'main.c')
-rw-r--r--main.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..1d17f79
--- /dev/null
+++ b/main.c
@@ -0,0 +1,25 @@
+#include "input.h"
+#include "file.h"
+#include "editor.h"
+#include "terminal.h"
+
+int main(int argc, char** argv)
+{
+ enable_raw_mode();
+
+ struct editor_state editor;
+ init_editor(&editor);
+
+ if (argc >= 2) {
+ editor_open(&editor, argv[1]);
+ }
+
+ editor_set_status_message(&editor, "HELP: Ctrl+Q = quit, Ctrl+S = save, Ctrl+F = find");
+
+ while (1) {
+ editor_refresh_screen(&editor);
+ editor_process_keypress(&editor);
+ }
+
+ return 0;
+}