extfs helpers: Replace all 'gawk' occurences with @AWK@ meta variable.
[midnight-commander.git] / src / editor / edit-widget.h
bloba3b6310ecde5fbe4412fb7d08ffb47d9122ccc02
1 /** \file
2 * \brief Header: editor widget WEdit
3 */
5 #ifndef MC__EDIT_WIDGET_H
6 #define MC__EDIT_WIDGET_H
8 #include "lib/search.h" /* mc_search_t */
9 #include "lib/widget.h" /* Widget */
11 #include "edit-impl.h"
13 /*** typedefs(not structures) and defined constants **********************************************/
15 #define MAX_MACRO_LENGTH 1024
16 #define N_LINE_CACHES 32
18 /*** enums ***************************************************************************************/
20 /*** structures declarations (and typedefs of structures)*****************************************/
22 struct _book_mark
24 int line; /* line number */
25 int c; /* color */
26 struct _book_mark *next;
27 struct _book_mark *prev;
30 struct syntax_rule
32 unsigned short keyword;
33 unsigned char end;
34 unsigned char context;
35 unsigned char _context;
36 unsigned char border;
39 struct WEdit
41 Widget widget;
43 char *filename; /* Name of the file */
44 char *dir; /* NULL if filename is absolute */
46 /* dynamic buffers and cursor position for editor: */
47 long curs1; /* position of the cursor from the beginning of the file. */
48 long curs2; /* position from the end of the file */
49 unsigned char *buffers1[MAXBUFF + 1]; /* all data up to curs1 */
50 unsigned char *buffers2[MAXBUFF + 1]; /* all data from end of file down to curs2 */
52 /* UTF8 */
53 char charbuf[4 + 1];
54 int charpoint;
56 /* search handler */
57 mc_search_t *search;
58 int replace_mode;
60 char *last_search_string; /* String that have been searched */
61 long search_start; /* First character to start searching from */
62 int found_len; /* Length of found string or 0 if none was found */
63 long found_start; /* the found word from a search - start position */
65 /* display information */
66 long last_byte; /* Last byte of file */
67 long start_display; /* First char displayed */
68 long start_col; /* First displayed column, negative */
69 long max_column; /* The maximum cursor position ever reached used to calc hori scroll bar */
70 long curs_row; /* row position of cursor on the screen */
71 long curs_col; /* column position on screen */
72 long over_col; /* pos after '\n' */
73 int force; /* how much of the screen do we redraw? */
74 unsigned int overwrite:1; /* Overwrite on type mode (as opposed to insert) */
75 unsigned int modified:1; /* File has been modified and needs saving */
76 unsigned int loading_done:1; /* File has been loaded into the editor */
77 unsigned int locked:1; /* We hold lock on current file */
78 unsigned int delete_file:1; /* New file, needs to be deleted unless modified */
79 unsigned int highlight:1; /* There is a selected block */
80 unsigned int column_highlight:1;
81 unsigned int utf8:1; /* It's multibyte file codeset */
82 long prev_col; /* recent column position of the cursor - used when moving
83 up or down past lines that are shorter than the current line */
84 long curs_line; /* line number of the cursor. */
85 long start_line; /* line number of the top of the page */
87 /* file info */
88 long total_lines; /* total lines in the file */
89 long mark1; /* position of highlight start */
90 long mark2; /* position of highlight end */
91 long end_mark_curs; /* position of cursor after end of highlighting */
92 int column1; /* position of column highlight start */
93 int column2; /* position of column highlight end */
94 long bracket; /* position of a matching bracket */
96 /* cache speedup for line lookups */
97 int caches_valid;
98 int line_numbers[N_LINE_CACHES];
99 long line_offsets[N_LINE_CACHES];
101 struct _book_mark *book_mark;
102 GArray *serialized_bookmarks;
104 /* undo stack and pointers */
105 unsigned long stack_pointer;
106 long *undo_stack;
107 unsigned long stack_size;
108 unsigned long stack_size_mask;
109 unsigned long stack_bottom;
110 unsigned int stack_disable:1; /* If not 0, don't save events in the undo stack */
112 struct stat stat1; /* Result of mc_fstat() on the file */
113 unsigned int skip_detach_prompt:1; /* Do not prompt whether to detach a file anymore */
115 /* syntax higlighting */
116 struct _syntax_marker *syntax_marker;
117 struct context_rule **rules;
118 long last_get_rule;
119 struct syntax_rule rule;
120 char *syntax_type; /* description of syntax highlighting type being used */
121 GTree *defines; /* List of defines */
122 gboolean is_case_insensitive; /* selects language case sensitivity */
124 /* macro stuff */
125 int macro_i; /* index to macro[], -1 if not recording a macro */
126 int macro_depth; /* depth of the macro recursion */
127 struct macro macro[MAX_MACRO_LENGTH];
129 /* user map stuff */
130 GIConv converter;
132 /* line break */
133 LineBreaks lb;
134 int extmod;
136 char *labels[10];
140 /*** global variables defined in .c file *********************************************************/
142 /*** declarations of public functions ************************************************************/
144 /*** inline functions ****************************************************************************/
145 #endif /* MC__EDIT_WIDGET_H */