edit-widget.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #ifndef __EDIT_WIDGET_H
  2. #define __EDIT_WIDGET_H
  3. #include "src/dlg.h" /* Widget */
  4. #define MAXBUFF 1024
  5. #define MAX_MACRO_LENGTH 1024
  6. #define N_LINE_CACHES 32
  7. struct macro {
  8. short command;
  9. short ch;
  10. };
  11. #define BOOK_MARK_COLOR ((25 << 8) | 5)
  12. #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;
  18. };
  19. struct syntax_rule {
  20. unsigned short keyword;
  21. unsigned char end;
  22. unsigned char context;
  23. unsigned char _context;
  24. unsigned char border;
  25. };
  26. struct WEdit {
  27. Widget widget;
  28. int num_widget_lines;
  29. int num_widget_columns;
  30. int have_frame;
  31. char *filename; /* Name of the file */
  32. /* dynamic buffers and cursor position for editor: */
  33. long curs1; /* position of the cursor from the beginning of the file. */
  34. long curs2; /* position from the end of the file */
  35. unsigned char *buffers1[MAXBUFF + 1]; /* all data up to curs1 */
  36. unsigned char *buffers2[MAXBUFF + 1]; /* all data from end of file down to curs2 */
  37. /* search variables */
  38. long search_start; /* First character to start searching from */
  39. int found_len; /* Length of found string or 0 if none was found */
  40. long found_start; /* the found word from a search - start position */
  41. /* display information */
  42. long last_byte; /* Last byte of file */
  43. long start_display; /* First char displayed */
  44. long start_col; /* First displayed column, negative */
  45. long max_column; /* The maximum cursor position ever reached used to calc hori scroll bar */
  46. long curs_row; /* row position of cursor on the screen */
  47. long curs_col; /* column position on screen */
  48. int force; /* how much of the screen do we redraw? */
  49. unsigned char overwrite;
  50. unsigned char modified; /* has the file been changed?: 1 if char inserted or
  51. deleted at all since last load or save */
  52. unsigned char screen_modified; /* has the file been changed since the last screen draw? */
  53. int delete_file; /* Has the file been created by the editor? Delete
  54. it at end of editing when it hasn't been modified
  55. or saved */
  56. unsigned char highlight;
  57. long prev_col; /* recent column position of the cursor - used when moving
  58. up or down past lines that are shorter than the current line */
  59. long curs_line; /* line number of the cursor. */
  60. long start_line; /* line number of the top of the page */
  61. /* file info */
  62. long total_lines; /* total lines in the file */
  63. long mark1; /* position of highlight start */
  64. long mark2; /* position of highlight end */
  65. int column1; /* position of column highlight start */
  66. int column2; /* position of column highlight end */
  67. long bracket; /* position of a matching bracket */
  68. /* cache speedup for line lookups */
  69. int caches_valid;
  70. int line_numbers[N_LINE_CACHES];
  71. long line_offsets[N_LINE_CACHES];
  72. struct _book_mark *book_mark;
  73. /* undo stack and pointers */
  74. unsigned long stack_pointer;
  75. long *undo_stack;
  76. unsigned long stack_size;
  77. unsigned long stack_size_mask;
  78. unsigned long stack_bottom;
  79. int stack_disable; /* If not 0, don't save events in the undo stack */
  80. struct stat stat1; /* Result of mc_fstat() on the file */
  81. /* syntax higlighting */
  82. struct _syntax_marker *syntax_marker;
  83. struct context_rule **rules;
  84. long last_get_rule;
  85. struct syntax_rule rule;
  86. char *syntax_type; /* description of syntax highlighting type being used */
  87. int explicit_syntax; /* have we forced the syntax hi. type in spite of the filename? */
  88. /* macro stuff */
  89. int macro_i; /* index to macro[], -1 if not recording a macro */
  90. int macro_depth; /* depth of the macro recursion */
  91. struct macro macro[MAX_MACRO_LENGTH];
  92. };
  93. #endif /* !__EDIT_WIDGET_H */