1
2
3
4
5 #ifndef MC__EDIT_WIDGET_H
6 #define MC__EDIT_WIDGET_H
7
8 #include <limits.h>
9
10 #include "lib/search.h"
11 #include "lib/widget.h"
12
13 #include "edit-impl.h"
14 #include "editbuffer.h"
15
16
17
18 #define N_LINE_CACHES 32
19
20
21
22
23
24 typedef struct edit_book_mark_t edit_book_mark_t;
25 struct edit_book_mark_t
26 {
27 long line;
28 int c;
29 edit_book_mark_t *next;
30 edit_book_mark_t *prev;
31 };
32
33 typedef struct edit_syntax_rule_t edit_syntax_rule_t;
34 struct edit_syntax_rule_t
35 {
36 unsigned short keyword;
37 off_t end;
38 unsigned char context;
39 unsigned char _context;
40 unsigned char border;
41 };
42
43
44
45
46
47
48
49 typedef enum
50 {
51 MCEDIT_DRAG_NONE = 0,
52 MCEDIT_DRAG_MOVE,
53 MCEDIT_DRAG_RESIZE
54 } mcedit_drag_state_t;
55
56 struct WEdit
57 {
58 Widget widget;
59 mcedit_drag_state_t drag_state;
60 int drag_state_start;
61
62
63 WRect loc_prev;
64
65 vfs_path_t *filename_vpath;
66 vfs_path_t *dir_vpath;
67
68
69 edit_buffer_t buffer;
70
71 #ifdef HAVE_CHARSET
72
73 gboolean utf8;
74 GIConv converter;
75 char charbuf[MB_LEN_MAX + 1];
76 int charpoint;
77 #endif
78
79
80 mc_search_t *search;
81 int replace_mode;
82
83 mc_search_line_t search_line_type;
84
85 char *last_search_string;
86 off_t search_start;
87 unsigned long found_len;
88 off_t found_start;
89
90
91 long start_display;
92 long start_col;
93 long curs_row;
94 long curs_col;
95 long over_col;
96 int force;
97 unsigned int overwrite : 1;
98 unsigned int modified : 1;
99 unsigned int loading_done : 1;
100 unsigned int locked : 1;
101 unsigned int delete_file : 1;
102 unsigned int highlight : 1;
103 unsigned int column_highlight : 1;
104 unsigned int fullscreen : 1;
105 long prev_col;
106
107 long start_line;
108
109
110 off_t mark1;
111 off_t mark2;
112 off_t end_mark_curs;
113 long column1;
114 long column2;
115 off_t bracket;
116 off_t last_bracket;
117
118
119 gboolean caches_valid;
120 long line_numbers[N_LINE_CACHES];
121 off_t line_offsets[N_LINE_CACHES];
122
123 edit_book_mark_t *book_mark;
124 GArray *serialized_bookmarks;
125
126
127 unsigned long undo_stack_pointer;
128 long *undo_stack;
129 unsigned long undo_stack_size;
130 unsigned long undo_stack_size_mask;
131 unsigned long undo_stack_bottom;
132 unsigned int undo_stack_disable : 1;
133
134 unsigned long redo_stack_pointer;
135 long *redo_stack;
136 unsigned long redo_stack_size;
137 unsigned long redo_stack_size_mask;
138 unsigned long redo_stack_bottom;
139 unsigned int redo_stack_reset : 1;
140
141 struct stat stat1;
142 unsigned long attrs;
143 gboolean attrs_ok;
144
145 unsigned int skip_detach_prompt : 1;
146
147
148 GSList *syntax_marker;
149 GPtrArray *rules;
150 off_t last_get_rule;
151 edit_syntax_rule_t rule;
152 char *syntax_type;
153 GTree *defines;
154 gboolean is_case_insensitive;
155
156
157 LineBreaks lb;
158 };
159
160
161
162
163
164
165 #endif