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/extmark_defs.h"
7 #include "nvim/mark_defs.h"
8 #include "nvim/pos.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 #define UH_RELOAD 0x04 // buffer was reloaded
76 
78 typedef struct {
80  FILE *bi_fp;
81 } bufinfo_T;
82 
83 #endif // NVIM_UNDO_DEFS_H
u_header::uh_seq
long uh_seq
Definition: undo_defs.h:54
u_header::uh_walk
int uh_walk
Definition: undo_defs.h:55
u_entry::ue_bot
linenr_T ue_bot
Definition: undo_defs.h:26
u_entry::ue_lcount
linenr_T ue_lcount
Definition: undo_defs.h:27
u_header::uh_entry
u_entry_T * uh_entry
Definition: undo_defs.h:56
u_header::uh_save_nr
long uh_save_nr
Definition: undo_defs.h:65
visualinfo_T
Definition: undo_defs.h:13
visualinfo_T::vi_mode
int vi_mode
Definition: undo_defs.h:16
visualinfo_T::vi_start
pos_T vi_start
Definition: undo_defs.h:14
u_header::uh_alt_prev
union u_header::@78 uh_alt_prev
u_header::uh_time
time_t uh_time
Definition: undo_defs.h:64
visualinfo_T::vi_end
pos_T vi_end
Definition: undo_defs.h:15
u_header::uh_prev
union u_header::@76 uh_prev
mark_defs.h
u_header::uh_visual
visualinfo_T uh_visual
Definition: undo_defs.h:63
bufinfo_T::bi_buf
buf_T * bi_buf
Definition: undo_defs.h:79
u_header::uh_alt_next
union u_header::@77 uh_alt_next
colnr_T
int colnr_T
Column number type.
Definition: pos.h:12
pos_T
Definition: pos.h:28
u_header::ptr
u_header_T * ptr
Definition: undo_defs.h:39
filemark
Structure defining single local mark.
Definition: mark_defs.h:35
u_header::uh_next
union u_header::@75 uh_next
u_header::uh_getbot_entry
u_entry_T * uh_getbot_entry
Definition: undo_defs.h:57
u_header::uh_flags
int uh_flags
Definition: undo_defs.h:60
u_entry
Definition: undo_defs.h:23
extmark_defs.h
u_entry::ue_top
linenr_T ue_top
Definition: undo_defs.h:25
u_header::uh_cursor
pos_T uh_cursor
Definition: undo_defs.h:58
u_header
Definition: undo_defs.h:35
char_u
unsigned char char_u
Definition: types.h:12
u_header::uh_cursor_vcol
long uh_cursor_vcol
Definition: undo_defs.h:59
file_buffer
Definition: buffer_defs.h:516
buffer_defs.h
u_header::uh_namedm
fmark_T uh_namedm[NMARKS]
Definition: undo_defs.h:61
u_header::seq
long seq
Definition: undo_defs.h:40
u_entry::ue_next
u_entry_T * ue_next
Definition: undo_defs.h:24
visualinfo_T::vi_curswant
colnr_T vi_curswant
Definition: undo_defs.h:17
u_entry::ue_size
long ue_size
Definition: undo_defs.h:29
linenr_T
long linenr_T
Definition: pos.h:7
NMARKS
#define NMARKS
Maximum possible number of letter marks.
Definition: mark_defs.h:17
bufinfo_T::bi_fp
FILE * bi_fp
Definition: undo_defs.h:80
bufinfo_T
Structure passed around between undofile functions.
Definition: undo_defs.h:78
pos.h
u_entry::ue_array
char_u ** ue_array
Definition: undo_defs.h:28
u_header::uh_extmark
extmark_undo_vec_t uh_extmark
Definition: undo_defs.h:62