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 59 long uh_cursor_vcol; 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 77 /// Structure passed around between undofile functions. 78 typedef struct { 79 buf_T *bi_buf; 80 FILE *bi_fp; 81 } bufinfo_T; 82 83 #endif // NVIM_UNDO_DEFS_H 84