2 * \brief Header: editor widget WEdit
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)*****************************************/
24 int line
; /* line number */
26 struct _book_mark
*next
;
27 struct _book_mark
*prev
;
32 unsigned short keyword
;
34 unsigned char context
;
35 unsigned char _context
;
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 */
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 */
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 */
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
;
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
;
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 */
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
];
140 /*** global variables defined in .c file *********************************************************/
142 /*** declarations of public functions ************************************************************/
144 /*** inline functions ****************************************************************************/
145 #endif /* MC__EDIT_WIDGET_H */