1 | #ifndef NVIM_UNDO_DEFS_H |
2 | #define NVIM_UNDO_DEFS_H |
3 | |
4 | #include <time.h> // for time_t |
5 | |
6 | #include "nvim/pos.h" |
7 | #include "nvim/mark_defs.h" |
8 | |
9 | typedef struct u_header ; |
10 | |
11 | /* Structure to store info about the Visual area. */ |
12 | typedef struct { |
13 | pos_T vi_start; /* start pos of last VIsual */ |
14 | pos_T vi_end; /* end position of last VIsual */ |
15 | int vi_mode; /* VIsual_mode of last VIsual */ |
16 | colnr_T vi_curswant; /* MAXCOL from w_curswant */ |
17 | } visualinfo_T; |
18 | |
19 | #include "nvim/buffer_defs.h" |
20 | |
21 | typedef struct u_entry u_entry_T; |
22 | struct u_entry { |
23 | u_entry_T *ue_next; /* pointer to next entry in list */ |
24 | linenr_T ue_top; /* number of line above undo block */ |
25 | linenr_T ue_bot; /* number of line below undo block */ |
26 | linenr_T ue_lcount; /* linecount when u_save called */ |
27 | char_u **ue_array; /* array of lines in undo block */ |
28 | long ue_size; /* number of lines in ue_array */ |
29 | #ifdef U_DEBUG |
30 | int ue_magic; /* magic number to check allocation */ |
31 | #endif |
32 | }; |
33 | |
34 | struct { |
35 | /* The following have a pointer and a number. The number is used when |
36 | * reading the undo file in u_read_undo() */ |
37 | union { |
38 | u_header_T *; /* pointer to next undo header in list */ |
39 | long ; |
40 | } ; |
41 | union { |
42 | u_header_T *; /* pointer to previous header in list */ |
43 | long ; |
44 | } ; |
45 | union { |
46 | u_header_T *; /* pointer to next header for alt. redo */ |
47 | long ; |
48 | } ; |
49 | union { |
50 | u_header_T *; /* pointer to previous header for alt. redo */ |
51 | long ; |
52 | } ; |
53 | long ; /* sequence number, higher == newer undo */ |
54 | int ; /* used by undo_time() */ |
55 | u_entry_T *; /* pointer to first entry */ |
56 | u_entry_T *; /* pointer to where ue_bot must be set */ |
57 | pos_T ; /* cursor position before saving */ |
58 | long ; |
59 | int ; /* see below */ |
60 | fmark_T [NMARKS]; /* marks before undo/after redo */ |
61 | visualinfo_T ; /* Visual areas before undo/after redo */ |
62 | time_t ; /* timestamp when the change was made */ |
63 | long ; /* set when the file was saved after the |
64 | changes in this block */ |
65 | #ifdef U_DEBUG |
66 | int uh_magic; /* magic number to check allocation */ |
67 | #endif |
68 | }; |
69 | |
70 | /* values for uh_flags */ |
71 | #define UH_CHANGED 0x01 /* b_changed flag before undo/after redo */ |
72 | #define UH_EMPTYBUF 0x02 /* buffer was empty */ |
73 | |
74 | /// Structure passed around between undofile functions. |
75 | typedef struct { |
76 | buf_T *bi_buf; |
77 | FILE *bi_fp; |
78 | } bufinfo_T; |
79 | |
80 | #endif // NVIM_UNDO_DEFS_H |
81 | |