tweaks: remove an unneeded element from the openfilestruct
Этот коммит содержится в:
родитель
e64e54d57f
Коммит
9c4ebed3ff
@ -116,7 +116,7 @@ void prepare_palette(void)
|
||||
#endif
|
||||
|
||||
/* For each coloring expression, initialize the color pair. */
|
||||
for (ink = openfile->colorstrings; ink != NULL; ink = ink->next) {
|
||||
for (ink = openfile->syntax->color; ink != NULL; ink = ink->next) {
|
||||
foreground = ink->fg;
|
||||
background = ink->bg;
|
||||
|
||||
@ -249,7 +249,6 @@ void find_and_prime_applicable_syntax(void)
|
||||
}
|
||||
|
||||
openfile->syntax = sntx;
|
||||
openfile->colorstrings = (sntx == NULL ? NULL : sntx->color);
|
||||
}
|
||||
|
||||
/* Allocate and initialize (for the given line) the cache for multiline info. */
|
||||
@ -277,7 +276,7 @@ void check_the_multis(linestruct *line)
|
||||
if (line->multidata == NULL)
|
||||
set_up_multicache(line);
|
||||
|
||||
for (ink = openfile->colorstrings; ink != NULL; ink = ink->next) {
|
||||
for (ink = openfile->syntax->color; ink != NULL; ink = ink->next) {
|
||||
/* If it's not a multiline regex, skip. */
|
||||
if (ink->end == NULL)
|
||||
continue;
|
||||
@ -316,14 +315,14 @@ void precalc_multicolorinfo(void)
|
||||
regmatch_t startmatch, endmatch;
|
||||
linestruct *line, *tailline;
|
||||
|
||||
if (openfile->colorstrings == NULL || ISSET(NO_COLOR_SYNTAX))
|
||||
if (openfile->syntax == NULL || ISSET(NO_COLOR_SYNTAX))
|
||||
return;
|
||||
|
||||
/* For each line, allocate cache space for the multiline-regex info. */
|
||||
for (line = openfile->filetop; line != NULL; line = line->next)
|
||||
set_up_multicache(line);
|
||||
|
||||
for (ink = openfile->colorstrings; ink != NULL; ink = ink->next) {
|
||||
for (ink = openfile->syntax->color; ink != NULL; ink = ink->next) {
|
||||
/* If this is not a multi-line regex, skip it. */
|
||||
if (ink->end == NULL)
|
||||
continue;
|
||||
|
@ -97,7 +97,6 @@ void make_new_buffer(void)
|
||||
#endif
|
||||
#ifdef ENABLE_COLOR
|
||||
openfile->syntax = NULL;
|
||||
openfile->colorstrings = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -403,9 +403,7 @@ typedef struct openfilestruct {
|
||||
/* Whether the file has been modified. */
|
||||
#ifdef ENABLE_COLOR
|
||||
syntaxtype *syntax;
|
||||
/* The syntax struct for this file, if any. */
|
||||
colortype *colorstrings;
|
||||
/* The file's associated colors. */
|
||||
/* The syntax that applies to this file, if any. */
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
struct openfilestruct *next;
|
||||
|
@ -646,7 +646,7 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
|
||||
#ifdef ENABLE_COLOR
|
||||
/* When doing syntax coloring, the replacement might require
|
||||
* a change of colors, so refresh the whole edit window. */
|
||||
if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX))
|
||||
if (openfile->syntax && !ISSET(NO_COLOR_SYNTAX))
|
||||
edit_refresh();
|
||||
else
|
||||
#endif
|
||||
|
@ -2422,8 +2422,8 @@ void draw_row(int row, const char *converted, linestruct *line, size_t from_col)
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
/* If color syntaxes are available and turned on, apply them. */
|
||||
if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX)) {
|
||||
const colortype *varnish = openfile->colorstrings;
|
||||
if (openfile->syntax && !ISSET(NO_COLOR_SYNTAX)) {
|
||||
const colortype *varnish = openfile->syntax->color;
|
||||
|
||||
/* If there are multiline regexes, make sure there is a cache. */
|
||||
if (openfile->syntax->nmultis > 0 && line->multidata == NULL)
|
||||
@ -3259,7 +3259,7 @@ void edit_refresh(void)
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
/* When needed and useful, initialize the colors for the current syntax. */
|
||||
if (!have_palette && has_colors())
|
||||
if (openfile->syntax && !have_palette && !ISSET(NO_COLOR_SYNTAX) && has_colors())
|
||||
prepare_palette();
|
||||
#endif
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user