2020-02-12 00:40:45 +00:00
|
|
|
/*
|
|
|
|
* kyle's text editor
|
|
|
|
*
|
|
|
|
* this is the v2 from-scratch rewrite
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <curses.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
|
|
|
|
|
2020-02-12 22:28:34 +00:00
|
|
|
struct buffer *buffers;
|
|
|
|
int nbufs;
|
|
|
|
int cbuf; /* current buffer */
|
2020-02-12 00:40:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
main()
|
|
|
|
{
|
|
|
|
int c, up = 1;
|
|
|
|
|
2020-02-12 22:28:34 +00:00
|
|
|
buffers = calloc(1, sizeof(struct buffer));
|
|
|
|
nbufs = 1;
|
|
|
|
cbuf = 0;
|
|
|
|
|
2020-02-12 00:40:45 +00:00
|
|
|
terminal_init();
|
|
|
|
terminal_message("welcome to KTE", 14);
|
|
|
|
terminal_refresh();
|
|
|
|
|
|
|
|
atexit(terminal_deinit);
|
|
|
|
|
|
|
|
do {
|
|
|
|
if (up) {
|
|
|
|
terminal_refresh();
|
|
|
|
}
|
|
|
|
c = terminal_getch();
|
|
|
|
up = handle_keypress(c);
|
|
|
|
} while (1);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|