* edit.h (struct key_word): Remove unused "bg" field, rename
"fg" to "color", since it keeps all color information. * syntax.c (edit_get_syntax_color): Replace "fg" and "bg" arguments with a single argument "color". Adjust all dependencies.
Этот коммит содержится в:
родитель
5f771b594e
Коммит
a23618b2ef
@ -1,5 +1,11 @@
|
|||||||
2002-07-14 Pavel Roskin <proski@gnu.org>
|
2002-07-14 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
|
* edit.h (struct key_word): Remove unused "bg" field, rename
|
||||||
|
"fg" to "color", since it keeps all color information.
|
||||||
|
* syntax.c (edit_get_syntax_color): Replace "fg" and "bg"
|
||||||
|
arguments with a single argument "color".
|
||||||
|
Adjust all dependencies.
|
||||||
|
|
||||||
* editdraw.c (edit_draw_this_line): Fix setting MOD_ABNORMAL
|
* editdraw.c (edit_draw_this_line): Fix setting MOD_ABNORMAL
|
||||||
attribute.
|
attribute.
|
||||||
(print_to_widget): Fix displaying non-printable characters with
|
(print_to_widget): Fix displaying non-printable characters with
|
||||||
|
@ -565,8 +565,8 @@ WEdit *edit_init (WEdit * edit, int lines, int columns, const char *filename, co
|
|||||||
edit->modified = 0;
|
edit->modified = 0;
|
||||||
edit_load_syntax (edit, 0, 0);
|
edit_load_syntax (edit, 0, 0);
|
||||||
{
|
{
|
||||||
int fg, bg;
|
int color;
|
||||||
edit_get_syntax_color (edit, -1, &fg, &bg);
|
edit_get_syntax_color (edit, -1, &color);
|
||||||
}
|
}
|
||||||
return edit;
|
return edit;
|
||||||
}
|
}
|
||||||
|
@ -168,8 +168,7 @@ struct key_word {
|
|||||||
#define NO_COLOR 0x7FFFFFFF
|
#define NO_COLOR 0x7FFFFFFF
|
||||||
#define SPELLING_ERROR 0x7EFEFEFE
|
#define SPELLING_ERROR 0x7EFEFEFE
|
||||||
int line_start;
|
int line_start;
|
||||||
int bg;
|
int color;
|
||||||
int fg;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct context_rule {
|
struct context_rule {
|
||||||
@ -310,7 +309,7 @@ void edit_split_filename (WEdit * edit, const char *name);
|
|||||||
void edit_set_syntax_change_callback (void (*callback) (CWidget *));
|
void edit_set_syntax_change_callback (void (*callback) (CWidget *));
|
||||||
void edit_load_syntax (WEdit * edit, char **names, char *type);
|
void edit_load_syntax (WEdit * edit, char **names, char *type);
|
||||||
void edit_free_syntax_rules (WEdit * edit);
|
void edit_free_syntax_rules (WEdit * edit);
|
||||||
void edit_get_syntax_color (WEdit * edit, long byte_index, int *fg, int *bg);
|
void edit_get_syntax_color (WEdit * edit, long byte_index, int *color);
|
||||||
int edit_check_spelling (WEdit * edit);
|
int edit_check_spelling (WEdit * edit);
|
||||||
|
|
||||||
|
|
||||||
|
@ -155,8 +155,8 @@ void edit_refresh_cmd (WEdit * edit)
|
|||||||
do_refresh();
|
do_refresh();
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
int fg, bg;
|
int color;
|
||||||
edit_get_syntax_color (edit, -1, &fg, &bg);
|
edit_get_syntax_color (edit, -1, &color);
|
||||||
}
|
}
|
||||||
touchwin(stdscr);
|
touchwin(stdscr);
|
||||||
#endif /* !HAVE_SLANG */
|
#endif /* !HAVE_SLANG */
|
||||||
|
@ -243,7 +243,7 @@ static void edit_draw_this_line (WEdit * edit, long b, long row, long start_col,
|
|||||||
long m1 = 0, m2 = 0, q, c1, c2;
|
long m1 = 0, m2 = 0, q, c1, c2;
|
||||||
int col, start_col_real;
|
int col, start_col_real;
|
||||||
unsigned int c;
|
unsigned int c;
|
||||||
int fg, bg;
|
int color;
|
||||||
int i, book_mark = -1;
|
int i, book_mark = -1;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@ -251,7 +251,7 @@ static void edit_draw_this_line (WEdit * edit, long b, long row, long start_col,
|
|||||||
book_mark = -1;
|
book_mark = -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
edit_get_syntax_color (edit, b - 1, &fg, &bg);
|
edit_get_syntax_color (edit, b - 1, &color);
|
||||||
q = edit_move_forward3 (edit, b, start_col - edit->start_col, 0);
|
q = edit_move_forward3 (edit, b, start_col - edit->start_col, 0);
|
||||||
start_col_real = (col = (int) edit_move_forward3 (edit, b, 0, q)) + edit->start_col;
|
start_col_real = (col = (int) edit_move_forward3 (edit, b, 0, q)) + edit->start_col;
|
||||||
c1 = min (edit->column1, edit->column2);
|
c1 = min (edit->column1, edit->column2);
|
||||||
@ -281,8 +281,8 @@ static void edit_draw_this_line (WEdit * edit, long b, long row, long start_col,
|
|||||||
c = edit_get_byte (edit, q);
|
c = edit_get_byte (edit, q);
|
||||||
/* we don't use bg for mc - fg contains both */
|
/* we don't use bg for mc - fg contains both */
|
||||||
if (book_mark == -1) {
|
if (book_mark == -1) {
|
||||||
edit_get_syntax_color (edit, q, &fg, &bg);
|
edit_get_syntax_color (edit, q, &color);
|
||||||
*p |= fg << 16;
|
*p |= color << 16;
|
||||||
} else {
|
} else {
|
||||||
*p |= book_mark << 16;
|
*p |= book_mark << 16;
|
||||||
}
|
}
|
||||||
|
@ -45,11 +45,6 @@
|
|||||||
int option_syntax_highlighting = 1;
|
int option_syntax_highlighting = 1;
|
||||||
int option_auto_spellcheck = 1;
|
int option_auto_spellcheck = 1;
|
||||||
|
|
||||||
/* these three functions are called from the outside */
|
|
||||||
void edit_load_syntax (WEdit * edit, char **names, char *type);
|
|
||||||
void edit_free_syntax_rules (WEdit * edit);
|
|
||||||
void edit_get_syntax_color (WEdit * edit, long byte_index, int *fg, int *bg);
|
|
||||||
|
|
||||||
#ifdef HAVE_MAD
|
#ifdef HAVE_MAD
|
||||||
static void *mad_syntax_malloc (size_t x, char *file, int line)
|
static void *mad_syntax_malloc (size_t x, char *file, int line)
|
||||||
#define syntax_malloc(x) mad_syntax_malloc (x, __FILE__, __LINE__)
|
#define syntax_malloc(x) mad_syntax_malloc (x, __FILE__, __LINE__)
|
||||||
@ -363,23 +358,22 @@ static struct syntax_rule edit_get_rule (WEdit * edit, long byte_index)
|
|||||||
return edit->rule;
|
return edit->rule;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void translate_rule_to_color (WEdit * edit, struct syntax_rule rule, int *fg, int *bg)
|
static void translate_rule_to_color (WEdit * edit, struct syntax_rule rule, int *color)
|
||||||
{
|
{
|
||||||
struct key_word *k;
|
struct key_word *k;
|
||||||
k = edit->rules[rule.context]->keyword[rule.keyword];
|
k = edit->rules[rule.context]->keyword[rule.keyword];
|
||||||
*bg = k->bg;
|
*color = k->color;
|
||||||
*fg = k->fg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int use_colors;
|
extern int use_colors;
|
||||||
|
|
||||||
void edit_get_syntax_color (WEdit * edit, long byte_index, int *fg, int *bg)
|
void edit_get_syntax_color (WEdit * edit, long byte_index, int *color)
|
||||||
{
|
{
|
||||||
if (edit->rules && byte_index < edit->last_byte &&
|
if (edit->rules && byte_index < edit->last_byte &&
|
||||||
option_syntax_highlighting && use_colors) {
|
option_syntax_highlighting && use_colors) {
|
||||||
translate_rule_to_color (edit, edit_get_rule (edit, byte_index), fg, bg);
|
translate_rule_to_color (edit, edit_get_rule (edit, byte_index), color);
|
||||||
} else {
|
} else {
|
||||||
*fg = EDITOR_NORMAL_COLOR;
|
*color = EDITOR_NORMAL_COLOR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -712,7 +706,7 @@ static int edit_read_syntax_rules (WEdit * edit, FILE * f)
|
|||||||
a++;
|
a++;
|
||||||
strcpy (last_fg, fg ? fg : "");
|
strcpy (last_fg, fg ? fg : "");
|
||||||
strcpy (last_bg, bg ? bg : "");
|
strcpy (last_bg, bg ? bg : "");
|
||||||
c->keyword[0]->fg = this_try_alloc_color_pair (fg, bg);
|
c->keyword[0]->color = this_try_alloc_color_pair (fg, bg);
|
||||||
c->keyword[0]->keyword = (char *) strdup (" ");
|
c->keyword[0]->keyword = (char *) strdup (" ");
|
||||||
check_not_a;
|
check_not_a;
|
||||||
num_contexts++;
|
num_contexts++;
|
||||||
@ -760,7 +754,7 @@ static int edit_read_syntax_rules (WEdit * edit, FILE * f)
|
|||||||
fg = last_fg;
|
fg = last_fg;
|
||||||
if (!bg)
|
if (!bg)
|
||||||
bg = last_bg;
|
bg = last_bg;
|
||||||
k->fg = this_try_alloc_color_pair (fg, bg);
|
k->color = this_try_alloc_color_pair (fg, bg);
|
||||||
check_not_a;
|
check_not_a;
|
||||||
num_words++;
|
num_words++;
|
||||||
} else if (!strncmp (args[0], "#", 1)) {
|
} else if (!strncmp (args[0], "#", 1)) {
|
||||||
@ -1021,9 +1015,9 @@ void edit_free_syntax_rules (WEdit * edit)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void edit_get_syntax_color (WEdit * edit, long byte_index, int *fg, int *bg)
|
void edit_get_syntax_color (WEdit * edit, long byte_index, int *color)
|
||||||
{
|
{
|
||||||
*fg = EDITOR_NORMAL_COLOR;
|
*color = EDITOR_NORMAL_COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
int edit_check_spelling (WEdit * edit)
|
int edit_check_spelling (WEdit * edit)
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user