Use FALSE/TRUE in favour of false/true (reverts 4fcf4e9685d9b2e4b49bfa3f7d3709dbe48073b6)
[midnight-commander.git] / edit / edit-widget.h
blobab55764af5ddfa6eb70006231eedb0727ddd82c6
1 #ifndef MC_EDIT_WIDGET_H
2 #define MC_EDIT_WIDGET_H
4 #include "../src/dialog.h" /* Widget */
5 #include "edit.h"
7 #define MAX_MACRO_LENGTH 1024
8 #define N_LINE_CACHES 32
10 #define BOOK_MARK_COLOR ((25 << 8) | 5)
11 #define BOOK_MARK_FOUND_COLOR ((26 << 8) | 4)
13 struct _book_mark {
14 int line; /* line number */
15 int c; /* color */
16 struct _book_mark *next;
17 struct _book_mark *prev;
20 struct syntax_rule {
21 unsigned short keyword;
22 unsigned char end;
23 unsigned char context;
24 unsigned char _context;
25 unsigned char border;
28 typedef struct edit_key_map_type {
29 long key;
30 long command;
31 } edit_key_map_type;
33 struct WEdit {
34 Widget widget;
36 int num_widget_lines;
37 int num_widget_columns;
39 char *filename; /* Name of the file */
40 char *dir; /* NULL if filename is absolute */
42 /* dynamic buffers and cursor position for editor: */
43 long curs1; /* position of the cursor from the beginning of the file. */
44 long curs2; /* position from the end of the file */
45 unsigned char *buffers1[MAXBUFF + 1]; /* all data up to curs1 */
46 unsigned char *buffers2[MAXBUFF + 1]; /* all data from end of file down to curs2 */
48 /* search variables */
49 long search_start; /* First character to start searching from */
50 int found_len; /* Length of found string or 0 if none was found */
51 long found_start; /* the found word from a search - start position */
53 /* display information */
54 long last_byte; /* Last byte of file */
55 long start_display; /* First char displayed */
56 long start_col; /* First displayed column, negative */
57 long max_column; /* The maximum cursor position ever reached used to calc hori scroll bar */
58 long curs_row; /* row position of cursor on the screen */
59 long curs_col; /* column position on screen */
60 int force; /* how much of the screen do we redraw? */
61 unsigned int overwrite:1; /* Overwrite on type mode (as opposed to insert) */
62 unsigned int modified:1; /* File has been modified and needs saving */
63 unsigned int loading_done:1;/* File has been loaded into the editor */
64 unsigned int locked:1; /* We hold lock on current file */
65 unsigned int screen_modified:1; /* File has been changed since the last screen draw */
66 unsigned int delete_file:1; /* New file, needs to be deleted unless modified */
67 unsigned int highlight:1; /* There is a selected block */
68 long prev_col; /* recent column position of the cursor - used when moving
69 up or down past lines that are shorter than the current line */
70 long curs_line; /* line number of the cursor. */
71 long start_line; /* line number of the top of the page */
73 /* file info */
74 long total_lines; /* total lines in the file */
75 long mark1; /* position of highlight start */
76 long mark2; /* position of highlight end */
77 int column1; /* position of column highlight start */
78 int column2; /* position of column highlight end */
79 long bracket; /* position of a matching bracket */
81 /* cache speedup for line lookups */
82 int caches_valid;
83 int line_numbers[N_LINE_CACHES];
84 long line_offsets[N_LINE_CACHES];
86 struct _book_mark *book_mark;
88 /* undo stack and pointers */
89 unsigned long stack_pointer;
90 long *undo_stack;
91 unsigned long stack_size;
92 unsigned long stack_size_mask;
93 unsigned long stack_bottom;
94 unsigned int stack_disable:1; /* If not 0, don't save events in the undo stack */
96 struct stat stat1; /* Result of mc_fstat() on the file */
97 unsigned int skip_detach_prompt:1; /* Do not prompt whether to detach a file anymore */
99 /* syntax higlighting */
100 struct _syntax_marker *syntax_marker;
101 struct context_rule **rules;
102 long last_get_rule;
103 struct syntax_rule rule;
104 char *syntax_type; /* description of syntax highlighting type being used */
105 GTree *defines; /* List of defines */
107 /* macro stuff */
108 int macro_i; /* index to macro[], -1 if not recording a macro */
109 int macro_depth; /* depth of the macro recursion */
110 struct macro macro[MAX_MACRO_LENGTH];
112 /* user map stuff */
113 const edit_key_map_type *user_map;
114 const edit_key_map_type *ext_map;
116 int extmod;
118 char *labels[10];
121 #endif