2020-02-12 00:40:45 +00:00
|
|
|
/*
|
|
|
|
* defs.h
|
|
|
|
* common definitions for kte.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef KTE_DEFS_H
|
|
|
|
#define KTE_DEFS_H
|
|
|
|
|
2020-02-12 02:36:15 +00:00
|
|
|
|
2020-02-12 00:40:45 +00:00
|
|
|
#include <sys/queue.h>
|
2020-02-12 02:36:15 +00:00
|
|
|
#include <ncurses.h>
|
2020-02-12 00:40:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
#define KTE_TAB_STOP 8
|
|
|
|
#define KTE_MSG_TIME 5
|
|
|
|
|
|
|
|
#define MODE_NORMAL 0
|
|
|
|
#define MODE_KCMD 1
|
|
|
|
|
|
|
|
|
|
|
|
struct file_buffer {
|
|
|
|
char *filename;
|
|
|
|
int nrows;
|
|
|
|
|
|
|
|
/* where are we in the file? */
|
|
|
|
int curx, cury;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static struct {
|
|
|
|
WINDOW *main;
|
|
|
|
WINDOW *status;
|
|
|
|
WINDOW *message;
|
|
|
|
|
|
|
|
time_t msgtm;
|
|
|
|
|
|
|
|
LIST_HEAD(listhead, file_buffer) listhead;
|
|
|
|
} editor;
|
|
|
|
|
|
|
|
|
|
|
|
/* terminal.c */
|
2020-02-12 22:28:34 +00:00
|
|
|
void nextline(); /* TODO: destroy this */
|
2020-02-12 00:40:45 +00:00
|
|
|
void terminal_refresh();
|
|
|
|
void terminal_init();
|
|
|
|
void terminal_deinit();
|
|
|
|
void terminal_message(char *s, int l);
|
|
|
|
int terminal_getch();
|
|
|
|
|
|
|
|
/* input.c */
|
|
|
|
int handle_keypress(int c);
|
|
|
|
|
2020-02-12 22:28:34 +00:00
|
|
|
/* file_buffer.c */
|
|
|
|
void init_buffer(struct buffer *buf)
|
|
|
|
|
2020-02-12 00:40:45 +00:00
|
|
|
|
|
|
|
#endif /* KTE_DEFS_H */
|