keymap files: unification of Fxx keys: move to lower case.
[midnight-commander.git] / src / editor / edit-widget.h
blobfa866b4e30d398b95bfa520873f57a76b4a74d03
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 N_LINE_CACHES 32
17 /*** enums ***************************************************************************************/
19 /*** structures declarations (and typedefs of structures)*****************************************/
21 struct _book_mark
23 int line; /* line number */
24 int c; /* color */
25 struct _book_mark *next;
26 struct _book_mark *prev;
29 struct syntax_rule
31 unsigned short keyword;
32 unsigned char end;
33 unsigned char context;
34 unsigned char _context;
35 unsigned char border;
38 struct WEdit
40 Widget widget;
42 char *filename; /* Name of the file */
43 char *dir; /* NULL if filename is absolute */
45 /* dynamic buffers and cursor position for editor: */
46 long curs1; /* position of the cursor from the beginning of the file. */
47 long curs2; /* position from the end of the file */
48 unsigned char *buffers1[MAXBUFF + 1]; /* all data up to curs1 */
49 unsigned char *buffers2[MAXBUFF + 1]; /* all data from end of file down to curs2 */
51 /* UTF8 */
52 char charbuf[4 + 1];
53 int charpoint;
55 /* search handler */
56 mc_search_t *search;
57 int replace_mode;
59 char *last_search_string; /* String that have been searched */
60 long search_start; /* First character to start searching from */
61 int found_len; /* Length of found string or 0 if none was found */
62 long found_start; /* the found word from a search - start position */
64 /* display information */
65 long last_byte; /* Last byte of file */
66 long start_display; /* First char displayed */
67 long start_col; /* First displayed column, negative */
68 long max_column; /* The maximum cursor position ever reached used to calc hori scroll bar */
69 long curs_row; /* row position of cursor on the screen */
70 long curs_col; /* column position on screen */
71 long over_col; /* pos after '\n' */
72 int force; /* how much of the screen do we redraw? */
73 unsigned int overwrite:1; /* Overwrite on type mode (as opposed to insert) */
74 unsigned int modified:1; /* File has been modified and needs saving */
75 unsigned int loading_done:1; /* File has been loaded into the editor */
76 unsigned int locked:1; /* We hold lock on current file */
77 unsigned int delete_file:1; /* New file, needs to be deleted unless modified */
78 unsigned int highlight:1; /* There is a selected block */
79 unsigned int column_highlight:1;
80 unsigned int utf8:1; /* It's multibyte file codeset */
81 long prev_col; /* recent column position of the cursor - used when moving
82 up or down past lines that are shorter than the current line */
83 long curs_line; /* line number of the cursor. */
84 long start_line; /* line number of the top of the page */
86 /* file info */
87 long total_lines; /* total lines in the file */
88 long mark1; /* position of highlight start */
89 long mark2; /* position of highlight end */
90 long end_mark_curs; /* position of cursor after end of highlighting */
91 int column1; /* position of column highlight start */
92 int column2; /* position of column highlight end */
93 long bracket; /* position of a matching bracket */
95 /* cache speedup for line lookups */
96 int caches_valid;
97 int line_numbers[N_LINE_CACHES];
98 long line_offsets[N_LINE_CACHES];
100 struct _book_mark *book_mark;
101 GArray *serialized_bookmarks;
103 /* undo stack and pointers */
104 unsigned long undo_stack_pointer;
105 long *undo_stack;
106 unsigned long undo_stack_size;
107 unsigned long undo_stack_size_mask;
108 unsigned long undo_stack_bottom;
109 unsigned int undo_stack_disable:1; /* If not 0, don't save events in the undo stack */
111 unsigned long redo_stack_pointer;
112 long *redo_stack;
113 unsigned long redo_stack_size;
114 unsigned long redo_stack_size_mask;
115 unsigned long redo_stack_bottom;
116 unsigned int redo_stack_reset:1; /* If 1, need clear redo stack */
118 struct stat stat1; /* Result of mc_fstat() on the file */
119 unsigned int skip_detach_prompt:1; /* Do not prompt whether to detach a file anymore */
121 /* syntax higlighting */
122 struct _syntax_marker *syntax_marker;
123 struct context_rule **rules;
124 long last_get_rule;
125 struct syntax_rule rule;
126 char *syntax_type; /* description of syntax highlighting type being used */
127 GTree *defines; /* List of defines */
128 gboolean is_case_insensitive; /* selects language case sensitivity */
130 /* user map stuff */
131 GIConv converter;
133 /* line break */
134 LineBreaks lb;
135 gboolean extmod;
137 char *labels[10];
141 /*** global variables defined in .c file *********************************************************/
143 /*** declarations of public functions ************************************************************/
145 /*** inline functions ****************************************************************************/
146 #endif /* MC__EDIT_WIDGET_H */