mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
syntax highlighting for perl plus syntax highlighting fixes.
This commit is contained in:
parent
2ea209b24d
commit
cf16bf846b
@ -38,9 +38,7 @@
|
||||
# include <sys/stat.h>
|
||||
# include <errno.h>
|
||||
|
||||
# ifdef HAVE_FCNTL_H
|
||||
# include <fcntl.h>
|
||||
# endif
|
||||
# include <fcntl.h>
|
||||
|
||||
# include <stdlib.h>
|
||||
# include <malloc.h>
|
||||
@ -304,14 +302,17 @@ struct context_rule {
|
||||
int between_delimiters;
|
||||
char *whole_word_chars_left;
|
||||
char *whole_word_chars_right;
|
||||
unsigned char *conflicts;
|
||||
char *keyword_first_chars;
|
||||
char *keyword_last_chars;
|
||||
/* first word is word[1] */
|
||||
struct key_word **keyword;
|
||||
};
|
||||
|
||||
|
||||
struct _syntax_marker {
|
||||
long offset;
|
||||
unsigned long rule;
|
||||
struct _syntax_marker *next;
|
||||
};
|
||||
|
||||
struct editor_widget {
|
||||
#ifdef MIDNIGHT
|
||||
@ -375,6 +376,12 @@ struct editor_widget {
|
||||
int column2; /*position of column highlight end */
|
||||
long bracket; /*position of a matching bracket */
|
||||
|
||||
/* cache speedup for line lookups */
|
||||
#define N_LINE_CACHES 32
|
||||
int caches_valid;
|
||||
int line_numbers[N_LINE_CACHES];
|
||||
long line_offsets[N_LINE_CACHES];
|
||||
|
||||
/* undo stack and pointers */
|
||||
unsigned long stack_pointer;
|
||||
long *undo_stack;
|
||||
@ -384,6 +391,7 @@ struct editor_widget {
|
||||
struct stat stat;
|
||||
|
||||
/* syntax higlighting */
|
||||
struct _syntax_marker *syntax_marker;
|
||||
struct context_rule **rules;
|
||||
long last_get_rule;
|
||||
unsigned long rule;
|
||||
|
@ -260,7 +260,11 @@ int edit_save_file (WEdit * edit, const char *filename)
|
||||
return 0;
|
||||
savedir[slashpos - filename + 1] = '\0';
|
||||
}
|
||||
#ifdef HAVE_MAD
|
||||
savename = strdup (tempnam (savedir, "cooledit"));
|
||||
#else
|
||||
savename = tempnam (savedir, "cooledit");
|
||||
#endif
|
||||
if (slashpos)
|
||||
free (savedir);
|
||||
if (!savename)
|
||||
|
@ -461,10 +461,8 @@ void render_edit_text (WEdit * edit, long start_row, long start_column, long end
|
||||
{
|
||||
long row = 0, curs_row;
|
||||
static int prev_curs_row = 0;
|
||||
static long prev_start_display = 0;
|
||||
static int prev_start_col = 0;
|
||||
static long prev_curs = 0;
|
||||
unsigned long syntax_rule;
|
||||
|
||||
#ifndef MIDNIGHT
|
||||
static unsigned long prev_win = 0;
|
||||
@ -474,9 +472,6 @@ void render_edit_text (WEdit * edit, long start_row, long start_column, long end
|
||||
int force = edit->force;
|
||||
long b;
|
||||
|
||||
edit_get_syntax_color (edit, edit->start_display - 1, &fg, &bg);
|
||||
syntax_rule = edit->rule;
|
||||
|
||||
/*
|
||||
if the position of the page has not moved then we can draw the cursor character only.
|
||||
This will prevent line flicker when using arrow keys.
|
||||
@ -580,7 +575,6 @@ void render_edit_text (WEdit * edit, long start_row, long start_column, long end
|
||||
|
||||
prev_curs_row = edit->curs_row;
|
||||
prev_curs = edit->curs1;
|
||||
prev_start_display = edit->start_display;
|
||||
prev_start_col = edit->start_col;
|
||||
#ifndef MIDNIGHT
|
||||
#ifdef GTK
|
||||
@ -590,8 +584,6 @@ void render_edit_text (WEdit * edit, long start_row, long start_column, long end
|
||||
#endif
|
||||
#endif
|
||||
exit_render:
|
||||
edit->last_get_rule = edit->start_display - 1;
|
||||
edit->rule = syntax_rule;
|
||||
}
|
||||
|
||||
|
||||
|
3863
gtkedit/syntax.c
3863
gtkedit/syntax.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user