Removed hardcoded hotkeys in dialog.c Replaced keymap's initialization from main...
[midnight-commander.git] / src / editor / edit-widget.h
blobc51b15d2c5cb8900c22b30e5c1f5fba27a8d0506
2 /** \file
3 * \brief Header: editor widget WEdit
4 */
6 #ifndef MC_EDIT_WIDGET_H
7 #define MC_EDIT_WIDGET_H
9 #include "src/dialog.h" /* Widget */
10 #include "lib/search.h" /* mc_search_t */
12 #include "edit-impl.h"
14 #define MAX_MACRO_LENGTH 1024
15 #define N_LINE_CACHES 32
17 struct _book_mark
19 int line; /* line number */
20 int c; /* color */
21 struct _book_mark *next;
22 struct _book_mark *prev;
25 struct syntax_rule
27 unsigned short keyword;
28 unsigned char end;
29 unsigned char context;
30 unsigned char _context;
31 unsigned char border;
34 struct WEdit
36 Widget widget;
38 int num_widget_lines;
39 int num_widget_columns;
41 char *filename; /* Name of the file */
42 char *dir; /* NULL if filename is absolute */
44 /* dynamic buffers and cursor position for editor: */
45 long curs1; /* position of the cursor from the beginning of the file. */
46 long curs2; /* position from the end of the file */
47 unsigned char *buffers1[MAXBUFF + 1]; /* all data up to curs1 */
48 unsigned char *buffers2[MAXBUFF + 1]; /* all data from end of file down to curs2 */
50 /* UTF8 */
51 char charbuf[4 + 1];
52 int charpoint;
54 /* search handler */
55 mc_search_t *search;
56 int replace_mode;
58 long search_start; /* First character to start searching from */
59 int found_len; /* Length of found string or 0 if none was found */
60 long found_start; /* the found word from a search - start position */
62 /* display information */
63 long last_byte; /* Last byte of file */
64 long start_display; /* First char displayed */
65 long start_col; /* First displayed column, negative */
66 long max_column; /* The maximum cursor position ever reached used to calc hori scroll bar */
67 long curs_row; /* row position of cursor on the screen */
68 long curs_col; /* column position on screen */
69 long over_col; /* pos after '\n' */
70 int force; /* how much of the screen do we redraw? */
71 unsigned int overwrite:1; /* Overwrite on type mode (as opposed to insert) */
72 unsigned int modified:1; /* File has been modified and needs saving */
73 unsigned int loading_done:1; /* File has been loaded into the editor */
74 unsigned int locked:1; /* We hold lock on current file */
75 unsigned int screen_modified:1; /* File has been changed since the last screen draw */
76 unsigned int delete_file:1; /* New file, needs to be deleted unless modified */
77 unsigned int highlight:1; /* There is a selected block */
78 unsigned int utf8:1; /* It's multibyte file codeset */
79 long prev_col; /* recent column position of the cursor - used when moving
80 up or down past lines that are shorter than the current line */
81 long curs_line; /* line number of the cursor. */
82 long start_line; /* line number of the top of the page */
84 /* file info */
85 long total_lines; /* total lines in the file */
86 long mark1; /* position of highlight start */
87 long mark2; /* position of highlight end */
88 int column1; /* position of column highlight start */
89 int column2; /* position of column highlight end */
90 long bracket; /* position of a matching bracket */
92 /* cache speedup for line lookups */
93 int caches_valid;
94 int line_numbers[N_LINE_CACHES];
95 long line_offsets[N_LINE_CACHES];
97 struct _book_mark *book_mark;
99 /* undo stack and pointers */
100 unsigned long stack_pointer;
101 long *undo_stack;
102 unsigned long stack_size;
103 unsigned long stack_size_mask;
104 unsigned long stack_bottom;
105 unsigned int stack_disable:1; /* If not 0, don't save events in the undo stack */
107 struct stat stat1; /* Result of mc_fstat() on the file */
108 unsigned int skip_detach_prompt:1; /* Do not prompt whether to detach a file anymore */
110 /* syntax higlighting */
111 struct _syntax_marker *syntax_marker;
112 struct context_rule **rules;
113 long last_get_rule;
114 struct syntax_rule rule;
115 char *syntax_type; /* description of syntax highlighting type being used */
116 GTree *defines; /* List of defines */
117 gboolean is_case_insensitive; /* selects language case sensitivity */
119 /* macro stuff */
120 int macro_i; /* index to macro[], -1 if not recording a macro */
121 int macro_depth; /* depth of the macro recursion */
122 struct macro macro[MAX_MACRO_LENGTH];
124 /* user map stuff */
125 GIConv converter;
127 /* line break */
128 LineBreaks lb;
129 int extmod;
131 char *labels[10];
135 #endif /* MC_EDIT_WIDGET_H */