-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmicro.h
92 lines (81 loc) · 1.66 KB
/
micro.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#ifndef MICRO_H_
#define MICRO_H_
#include <termios.h>
#include <time.h>
#define CTRL_KEY(k) ((k)&0x1f)
#define APPEND_BUFFER_INIT \
{ \
NULL, 0 \
}
#define MICRO_VERSION "0.0.1"
#define AUTHOR "Swapneeth Gorantla (@dodeca12)"
#define REPO "https://github.com/dodeca12/Micro"
#define MICRO_TAB_STOP 8
#define MICRO_FORCE_QUIT 1
#define HL_HIGHLIGHT_NUMBERS (1 << 0)
#define HL_HIGHLIGHT_STRINGS (1 << 1)
typedef struct microRow
{
char *chars;
int size;
int rsize;
char *render;
unsigned char *highlight;
int idx;
int highlightOpenComment;
} microRow;
struct editorConfig
{
struct termios original_termios;
int screenRows, screenCols;
int cursorPosX, cursorPosY;
int renderPosX;
microRow *row;
char *fileName;
int numRows;
int rowOffset, colOffset;
char statusMessage[80];
time_t statusMessage_time;
int dirtyBuffer;
struct microSyntax *syntax;
} microConfig;
struct appendBuffer
{
char *b;
int len;
};
enum microKeyMap
{
BACKSPACE = 127,
LEFT_ARROW = 121212,
RIGHT_ARROW,
UP_ARROW,
DOWN_ARROW,
PAGE_UP,
PAGE_DOWN,
HOME_KEY,
END_KEY,
DELETE_KEY
};
enum microHighlight
{
HL_DEFAULT = 0,
HL_COMMENT,
HL_ML_COMMENT,
HL_KEYWORD1,
HL_KEYWORD2,
HL_STRING,
HL_NUMBER,
HL_MATCH
};
struct microSyntax
{
char *fileType;
char **fileMatch;
char **keywords;
char *singleLineCommentStart;
char *multiLineCommentStart;
char *multiLineCommentEnd;
int flags;
};
#endif // MICRO_H_