Ticket #2127: updated file extension for "sh"
[midnight-commander.git] / src / editor / edit-widget.h
blob0e452374aea205a767eb9a57053ffb310b01d327
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"
13 #include "src/keybind.h"
15 #define MAX_MACRO_LENGTH 1024
16 #define N_LINE_CACHES 32
18 struct _book_mark
20 int line; /* line number */
21 int c; /* color */
22 struct _book_mark *next;
23 struct _book_mark *prev;
26 struct syntax_rule
28 unsigned short keyword;
29 unsigned char end;
30 unsigned char context;
31 unsigned char _context;
32 unsigned char border;
35 struct WEdit
37 Widget widget;
39 int num_widget_lines;
40 int num_widget_columns;
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 long search_start; /* First character to start searching from */
60 int found_len; /* Length of found string or 0 if none was found */
61 long found_start; /* the found word from a search - start position */
63 /* display information */
64 long last_byte; /* Last byte of file */
65 long start_display; /* First char displayed */
66 long start_col; /* First displayed column, negative */
67 long max_column; /* The maximum cursor position ever reached used to calc hori scroll bar */
68 long curs_row; /* row position of cursor on the screen */
69 long curs_col; /* column position on screen */
70 long over_col; /* pos after '\n' */
71 int force; /* how much of the screen do we redraw? */
72 unsigned int overwrite:1; /* Overwrite on type mode (as opposed to insert) */
73 unsigned int modified:1; /* File has been modified and needs saving */
74 unsigned int loading_done:1; /* File has been loaded into the editor */
75 unsigned int locked:1; /* We hold lock on current file */
76 unsigned int screen_modified:1; /* File has been changed since the last screen draw */
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 utf8:1; /* It's multibyte file codeset */
80 long prev_col; /* recent column position of the cursor - used when moving
81 up or down past lines that are shorter than the current line */
82 long curs_line; /* line number of the cursor. */
83 long start_line; /* line number of the top of the page */
85 /* file info */
86 long total_lines; /* total lines in the file */
87 long mark1; /* position of highlight start */
88 long mark2; /* position of highlight end */
89 int column1; /* position of column highlight start */
90 int column2; /* position of column highlight end */
91 long bracket; /* position of a matching bracket */
93 /* cache speedup for line lookups */
94 int caches_valid;
95 int line_numbers[N_LINE_CACHES];
96 long line_offsets[N_LINE_CACHES];
98 struct _book_mark *book_mark;
100 /* undo stack and pointers */
101 unsigned long stack_pointer;
102 long *undo_stack;
103 unsigned long stack_size;
104 unsigned long stack_size_mask;
105 unsigned long stack_bottom;
106 unsigned int stack_disable:1; /* If not 0, don't save events in the undo stack */
108 struct stat stat1; /* Result of mc_fstat() on the file */
109 unsigned int skip_detach_prompt:1; /* Do not prompt whether to detach a file anymore */
111 /* syntax higlighting */
112 struct _syntax_marker *syntax_marker;
113 struct context_rule **rules;
114 long last_get_rule;
115 struct syntax_rule rule;
116 char *syntax_type; /* description of syntax highlighting type being used */
117 GTree *defines; /* List of defines */
118 gboolean is_case_insensitive; /* selects language case sensitivity */
120 /* macro stuff */
121 int macro_i; /* index to macro[], -1 if not recording a macro */
122 int macro_depth; /* depth of the macro recursion */
123 struct macro macro[MAX_MACRO_LENGTH];
125 /* user map stuff */
126 GIConv converter;
128 /* line break */
129 LineBreaks lb;
130 int extmod;
132 char *labels[10];
136 #endif /* MC_EDIT_WIDGET_H */