From 91195d34e1f71246cadc41705004d66ab647087e Mon Sep 17 00:00:00 2001 From: cflip Date: Sun, 8 Jan 2023 14:15:01 -0700 Subject: 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/. --- main.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 main.c (limited to 'main.c') 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; +} -- cgit v1.2.3