-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
/
mark_defs.h
89 lines (70 loc) · 2.93 KB
/
mark_defs.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
#ifndef NVIM_MARK_DEFS_H
#define NVIM_MARK_DEFS_H
#include "nvim/eval/typval.h"
#include "nvim/os/time.h"
#include "nvim/pos.h"
// marks: positions in a file
// (a normal mark is a lnum/col pair, the same as a file position)
/// Flags for outcomes when moving to a mark.
typedef enum {
kMarkMoveSuccess = 1, ///< Successful move.
kMarkMoveFailed = 2, ///< Failed to move.
kMarkSwitchedBuf = 4, ///< Switched curbuf.
kMarkChangedCol = 8, ///< Changed the cursor col.
kMarkChangedLine = 16, ///< Changed the cursor line.
kMarkChangedCursor = 32, ///< Changed the cursor.
kMarkChangedView = 64, ///< Changed the view.
} MarkMoveRes;
/// Flags to configure the movement to a mark.
typedef enum {
kMarkBeginLine = 1, ///< Move cursor to the beginning of the line.
kMarkContext = 2, ///< Leave context mark when moving the cursor.
KMarkNoContext = 4, ///< Don't leave a context mark.
kMarkSetView = 8, ///< Set the mark view after moving
kMarkJumpList = 16, ///< Special case, don't leave context mark when switching buffer
} MarkMove;
/// Options when getting a mark
typedef enum {
kMarkBufLocal, ///< Only return marks that belong to the buffer.
kMarkAll, ///< Return all types of marks.
kMarkAllNoResolve, ///< Return all types of marks but don't resolve fnum (global marks).
} MarkGet;
/// Number of possible numbered global marks
#define EXTRA_MARKS ('9' - '0' + 1)
/// Maximum possible number of letter marks
#define NMARKS ('z' - 'a' + 1)
/// Total possible number of global marks
#define NGLOBALMARKS (NMARKS + EXTRA_MARKS)
/// Total possible number of local marks
///
/// That are uppercase marks plus '"', '^' and '.'. There are other local marks,
/// but they are not saved in ShaDa files.
#define NLOCALMARKS (NMARKS + 3)
/// Max value of local mark
#define NMARK_LOCAL_MAX 126 // Index of '~'
/// Maximum number of marks in jump list
#define JUMPLISTSIZE 100
/// Maximum number of tags in tag stack
#define TAGSTACKSIZE 20
/// Represents view in which the mark was created
typedef struct fmarkv {
linenr_T topline_offset; ///< Amount of lines from the mark lnum to the top of the window.
///< Use MAXLNUM to indicate that the mark does not have a view.
} fmarkv_T;
#define INIT_FMARKV { MAXLNUM }
/// Structure defining single local mark
typedef struct filemark {
pos_T mark; ///< Cursor position.
int fnum; ///< File number.
Timestamp timestamp; ///< Time when this mark was last set.
fmarkv_T view; ///< View the mark was created on
dict_T *additional_data; ///< Additional data from ShaDa file.
} fmark_T;
#define INIT_FMARK { { 0, 0, 0 }, 0, 0, INIT_FMARKV, NULL }
/// Structure defining extended mark (mark with file name attached)
typedef struct xfilemark {
fmark_T fmark; ///< Actual mark.
char *fname; ///< File name, used when fnum == 0.
} xfmark_T;
#define INIT_XFMARK { INIT_FMARK, NULL }
#endif // NVIM_MARK_DEFS_H