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 N_LINE_CACHES 32
17 /*** enums ***************************************************************************************/
20 enum for store the search conditions check results.
21 (if search condition have BOL(^) or EOL ($) regexp checial characters).
25 AT_START_LINE
= (1 << 0),
26 AT_END_LINE
= (1 << 1)
29 /*** structures declarations (and typedefs of structures)*****************************************/
33 int line
; /* line number */
35 struct _book_mark
*next
;
36 struct _book_mark
*prev
;
41 unsigned short keyword
;
43 unsigned char context
;
44 unsigned char _context
;
49 * State of WEdit window
50 * MCEDIT_DRAG_NORMAL - window is in normal mode
51 * MCEDIT_DRAG_MOVE - window is being moved
52 * MCEDIT_DRAG_RESIZE - window is being resized
56 MCEDIT_DRAG_NORMAL
= 0,
59 } mcedit_drag_state_t
;
64 mcedit_drag_state_t drag_state
;
65 int drag_state_start
; /* save cursor position before window moving */
67 /* save location before move/resize */
69 int cols_prev
, lines_prev
;
71 vfs_path_t
*filename_vpath
; /* Name of the file */
72 vfs_path_t
*dir_vpath
; /* NULL if filename is absolute */
74 /* dynamic buffers and cursor position for editor: */
75 long curs1
; /* position of the cursor from the beginning of the file. */
76 long curs2
; /* position from the end of the file */
77 unsigned char *buffers1
[MAXBUFF
+ 1]; /* all data up to curs1 */
78 unsigned char *buffers2
[MAXBUFF
+ 1]; /* all data from end of file down to curs2 */
87 /* is search conditions should be started from BOL(^) or ended with EOL($) */
88 edit_search_line_t search_line_type
;
90 char *last_search_string
; /* String that have been searched */
91 long search_start
; /* First character to start searching from */
92 int found_len
; /* Length of found string or 0 if none was found */
93 long found_start
; /* the found word from a search - start position */
95 /* display information */
96 long last_byte
; /* Last byte of file */
97 long start_display
; /* First char displayed */
98 long start_col
; /* First displayed column, negative */
99 long max_column
; /* The maximum cursor position ever reached used to calc hori scroll bar */
100 long curs_row
; /* row position of cursor on the screen */
101 long curs_col
; /* column position on screen */
102 long over_col
; /* pos after '\n' */
103 int force
; /* how much of the screen do we redraw? */
104 unsigned int overwrite
:1; /* Overwrite on type mode (as opposed to insert) */
105 unsigned int modified
:1; /* File has been modified and needs saving */
106 unsigned int loading_done
:1; /* File has been loaded into the editor */
107 unsigned int locked
:1; /* We hold lock on current file */
108 unsigned int delete_file
:1; /* New file, needs to be deleted unless modified */
109 unsigned int highlight
:1; /* There is a selected block */
110 unsigned int column_highlight
:1;
111 unsigned int utf8
:1; /* It's multibyte file codeset */
112 long prev_col
; /* recent column position of the cursor - used when moving
113 up or down past lines that are shorter than the current line */
114 long curs_line
; /* line number of the cursor. */
115 long start_line
; /* line number of the top of the page */
118 long total_lines
; /* total lines in the file */
119 long mark1
; /* position of highlight start */
120 long mark2
; /* position of highlight end */
121 long end_mark_curs
; /* position of cursor after end of highlighting */
122 int column1
; /* position of column highlight start */
123 int column2
; /* position of column highlight end */
124 long bracket
; /* position of a matching bracket */
126 /* cache speedup for line lookups */
128 int line_numbers
[N_LINE_CACHES
];
129 long line_offsets
[N_LINE_CACHES
];
131 struct _book_mark
*book_mark
;
132 GArray
*serialized_bookmarks
;
134 /* undo stack and pointers */
135 unsigned long undo_stack_pointer
;
137 unsigned long undo_stack_size
;
138 unsigned long undo_stack_size_mask
;
139 unsigned long undo_stack_bottom
;
140 unsigned int undo_stack_disable
:1; /* If not 0, don't save events in the undo stack */
142 unsigned long redo_stack_pointer
;
144 unsigned long redo_stack_size
;
145 unsigned long redo_stack_size_mask
;
146 unsigned long redo_stack_bottom
;
147 unsigned int redo_stack_reset
:1; /* If 1, need clear redo stack */
149 struct stat stat1
; /* Result of mc_fstat() on the file */
150 unsigned int skip_detach_prompt
:1; /* Do not prompt whether to detach a file anymore */
152 /* syntax higlighting */
153 struct _syntax_marker
*syntax_marker
;
154 struct context_rule
**rules
;
156 struct syntax_rule rule
;
157 char *syntax_type
; /* description of syntax highlighting type being used */
158 GTree
*defines
; /* List of defines */
159 gboolean is_case_insensitive
; /* selects language case sensitivity */
172 /*** global variables defined in .c file *********************************************************/
174 /*** declarations of public functions ************************************************************/
176 /*** inline functions ****************************************************************************/
177 #endif /* MC__EDIT_WIDGET_H */