-
Notifications
You must be signed in to change notification settings - Fork 0
/
motion.h
82 lines (68 loc) · 1.49 KB
/
motion.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
#ifndef MOTION_H
#define MOTION_H
typedef union motion_arg motion_arg;
typedef int motion_func(
motion_arg const *,
unsigned repeat,
window *,
/*point_t *current, * both changeable */
point_t *to);
enum motion_wise
{
M_NONE = 0,
M_LINEWISE = 1 << 0,
M_EXCLUSIVE = 1 << 1,
M_COLUMN = 1 << 2,
};
enum word_wise
{
WORD_NONE = 0,
WORD_BACKWARD = 1 << 0, /* b,B,ge,gE not w,W,e,E */
WORD_END = 1 << 1, /* e,E,ge,gE not w,W,b,B */
WORD_SPACE = 1 << 2, /* W, E, B, gE */
};
union motion_arg
{
int i;
enum word_wise word_type;
enum find_type
{
F_TIL = 1 << 0, /* 'f' or 't' */
F_REV = 1 << 1, /* 'F' or 'T' */
} find_type;
point_t pos;
enum case_tog case_type;
enum motion_wise *phow;
struct
{
signed char dir;
char scan_ch;
};
};
motion_func m_eof, m_eol, m_eos, m_goto, m_mos, m_move, m_sof, m_sol, m_sos;
motion_func m_col;
motion_func m_find, m_findnext;
motion_func m_word;
motion_func m_para, m_paren, m_func;
motion_func m_search, m_searchnext;
motion_func m_visual;
void m_setlastsearch(char *, bool forward);
typedef struct motion
{
motion_func *func;
motion_arg arg;
enum motion_wise how;
} motion;
#define MOTION_REPEAT() { NULL, 0U }
#define DEFAULT_REPEAT(r) (r ? r : 1)
int motion_apply_win(
const motion *, unsigned rep,
window *);
int motion_apply_win_dry(
const motion *, unsigned rep,
window *, point_t *to);
bool motion_to_region(
const motion *m, unsigned repeat,
window *, region_t *out);
void start_of_line(point_t *, window *w);
#endif