undo_defs.h
Go to the documentation of this file.
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 u_header_T;
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 u_header {
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 *ptr; /* pointer to next undo header in list */
39  long seq;
40  } uh_next;
41  union {
42  u_header_T *ptr; /* pointer to previous header in list */
43  long seq;
44  } uh_prev;
45  union {
46  u_header_T *ptr; /* pointer to next header for alt. redo */
47  long seq;
48  } uh_alt_next;
49  union {
50  u_header_T *ptr; /* pointer to previous header for alt. redo */
51  long seq;
52  } uh_alt_prev;
53  long uh_seq; /* sequence number, higher == newer undo */
54  int uh_walk; /* used by undo_time() */
55  u_entry_T *uh_entry; /* pointer to first entry */
56  u_entry_T *uh_getbot_entry; /* pointer to where ue_bot must be set */
57  pos_T uh_cursor; /* cursor position before saving */
59  int uh_flags; /* see below */
60  fmark_T uh_namedm[NMARKS]; /* marks before undo/after redo */
61  visualinfo_T uh_visual; /* Visual areas before undo/after redo */
62  time_t uh_time; /* timestamp when the change was made */
63  long uh_save_nr; /* 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 
75 typedef struct {
77  FILE *bi_fp;
78 } bufinfo_T;
79 
80 #endif // NVIM_UNDO_DEFS_H
char_u ** ue_array
Definition: undo_defs.h:27
linenr_T ue_top
Definition: undo_defs.h:24
linenr_T ue_lcount
Definition: undo_defs.h:26
union u_header::@60 uh_next
#define NMARKS
Maximum possible number of letter marks.
Definition: mark_defs.h:17
colnr_T vi_curswant
Definition: undo_defs.h:16
visualinfo_T uh_visual
Definition: undo_defs.h:61
Structure passed around between undofile functions.
Definition: undo_defs.h:75
u_entry_T * uh_getbot_entry
Definition: undo_defs.h:56
u_entry_T * uh_entry
Definition: undo_defs.h:55
time_t uh_time
Definition: undo_defs.h:62
union u_header::@62 uh_alt_next
int colnr_T
Column number type.
Definition: pos.h:9
Structure defining single local mark.
Definition: mark_defs.h:35
u_entry_T * ue_next
Definition: undo_defs.h:23
u_header_T * ptr
Definition: undo_defs.h:38
Definition: buffer_defs.h:469
long ue_size
Definition: undo_defs.h:28
long seq
Definition: undo_defs.h:39
union u_header::@63 uh_alt_prev
fmark_T uh_namedm[NMARKS]
Definition: undo_defs.h:60
buf_T * bi_buf
Definition: undo_defs.h:76
int uh_flags
Definition: undo_defs.h:59
Definition: undo_defs.h:22
long uh_seq
Definition: undo_defs.h:53
int vi_mode
Definition: undo_defs.h:15
linenr_T ue_bot
Definition: undo_defs.h:25
long linenr_T
Definition: pos.h:4
long uh_cursor_vcol
Definition: undo_defs.h:58
pos_T vi_start
Definition: undo_defs.h:13
int uh_walk
Definition: undo_defs.h:54
unsigned char char_u
Definition: types.h:11
Definition: undo_defs.h:34
FILE * bi_fp
Definition: undo_defs.h:77
union u_header::@61 uh_prev
pos_T vi_end
Definition: undo_defs.h:14
Definition: pos.h:21
pos_T uh_cursor
Definition: undo_defs.h:57
long uh_save_nr
Definition: undo_defs.h:63
Definition: undo_defs.h:12