-
Notifications
You must be signed in to change notification settings - Fork 6
/
editor.h
54 lines (45 loc) · 1.09 KB
/
editor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef EDITOR_H
#define EDITOR_H
#include <stdbool.h>
#include <stdio.h>
#include <wchar.h>
#include CURSES_INCLUDE
#include "buffer.h"
#include "mode.h"
struct VIEW{
BUFFER *b;
POS p, tos, gb;
WINDOW *w;
MODE *m;
lineno bs, be;
void (*statuscb)(EDITOR *e, VIEW *v);
bool ex, uc, delay, et, q, ai, sm, se;
size_t ph, ts, lm, rm, sd;
wchar_t *dl;
size_t dln;
};
#define FUNC_MAX 10
#define CTRL_MAX 32
#define ERR_MAX 127
#define BM_MAX 10
struct EDITOR{
bool running, needsresize;
VIEW cmdview, docview, *focusview;
POS bm[BM_MAX], lc;
wchar_t *funcs[FUNC_MAX];
char ctrlmap[CTRL_MAX];
char name[FILENAME_MAX + 1];
char err[ERR_MAX + 1];
wchar_t *find;
size_t findn;
};
EDITOR *openeditor(const char *name, WINDOW *docwin, WINDOW *cmdwin);
void closeeditor(EDITOR *e);
void dispatch(EDITOR *e, VIEW *v, KEYSTROKE k);
void redisplay(VIEW *v);
void hilight(VIEW *v, POS p1, POS p2);
void clearhilight(VIEW *v);
bool error(EDITOR *e, const char *s);
KEYSTROKE getkeystroke(EDITOR *e, bool delay);
void fixcursor(EDITOR *e);
#endif