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