Commit 3c915ee0 authored by Egmont Koblinger's avatar Egmont Koblinger

emulation: Use more consistent and verbose names for special purpose colors

https://bugzilla.gnome.org/show_bug.cgi?id=725974
parent be8407db
......@@ -343,11 +343,11 @@ _vte_terminal_ring_insert (VteTerminal *terminal, glong position, gboolean fill)
VteRing *ring = terminal->pvt->screen->row_data;
while (G_UNLIKELY (_vte_ring_next (ring) < position)) {
row = _vte_ring_append (ring);
if (terminal->pvt->screen->fill_defaults.attr.back != VTE_DEF_BG)
if (terminal->pvt->screen->fill_defaults.attr.back != VTE_DEFAULT_BG)
_vte_row_data_fill (row, &terminal->pvt->screen->fill_defaults, terminal->column_count);
}
row = _vte_ring_insert (ring, position);
if (fill && terminal->pvt->screen->fill_defaults.attr.back != VTE_DEF_BG)
if (fill && terminal->pvt->screen->fill_defaults.attr.back != VTE_DEFAULT_BG)
_vte_row_data_fill (row, &terminal->pvt->screen->fill_defaults, terminal->column_count);
return row;
}
......@@ -2559,12 +2559,12 @@ _vte_terminal_set_color_internal(VteTerminal *terminal,
/* If we're setting the background color, set the background color
* on the widget as well. */
if (entry == VTE_DEF_BG) {
if (entry == VTE_DEFAULT_BG) {
vte_terminal_queue_background_update(terminal);
}
/* and redraw */
if (entry == VTE_CUR_BG)
if (entry == VTE_CURSOR_BG)
_vte_invalidate_cursor_once(terminal, FALSE);
else
_vte_invalidate_all (terminal);
......@@ -2672,7 +2672,7 @@ vte_terminal_set_color_foreground(VteTerminal *terminal,
_vte_debug_print(VTE_DEBUG_MISC,
"Set foreground color to (%04x,%04x,%04x).\n",
foreground->red, foreground->green, foreground->blue);
_vte_terminal_set_color_internal(terminal, VTE_DEF_FG, VTE_COLOR_SOURCE_API, foreground);
_vte_terminal_set_color_internal(terminal, VTE_DEFAULT_FG, VTE_COLOR_SOURCE_API, foreground);
}
/**
......@@ -2694,7 +2694,7 @@ vte_terminal_set_color_background(VteTerminal *terminal,
_vte_debug_print(VTE_DEBUG_MISC,
"Set background color to (%04x,%04x,%04x).\n",
background->red, background->green, background->blue);
_vte_terminal_set_color_internal(terminal, VTE_DEF_BG, VTE_COLOR_SOURCE_API, background);
_vte_terminal_set_color_internal(terminal, VTE_DEFAULT_BG, VTE_COLOR_SOURCE_API, background);
}
/**
......@@ -2724,7 +2724,7 @@ vte_terminal_set_color_cursor(VteTerminal *terminal,
_vte_debug_print(VTE_DEBUG_MISC,
"Reset cursor color.\n");
}
_vte_terminal_set_color_internal(terminal, VTE_CUR_BG, VTE_COLOR_SOURCE_API, cursor_background);
_vte_terminal_set_color_internal(terminal, VTE_CURSOR_BG, VTE_COLOR_SOURCE_API, cursor_background);
}
/**
......@@ -2754,7 +2754,7 @@ vte_terminal_set_color_highlight(VteTerminal *terminal,
_vte_debug_print(VTE_DEBUG_MISC,
"Reset highlight color.\n");
}
_vte_terminal_set_color_internal(terminal, VTE_DEF_HL, VTE_COLOR_SOURCE_API, highlight_background);
_vte_terminal_set_color_internal(terminal, VTE_HIGHLIGHT_BG, VTE_COLOR_SOURCE_API, highlight_background);
}
/**
......@@ -2842,7 +2842,7 @@ vte_terminal_set_colors(VteTerminal *terminal,
color.red = color.green = color.blue = shade | shade << 8;
}
else switch (i) {
case VTE_DEF_BG:
case VTE_DEFAULT_BG:
if (background != NULL) {
color = *background;
} else {
......@@ -2851,7 +2851,7 @@ vte_terminal_set_colors(VteTerminal *terminal,
color.green = 0;
}
break;
case VTE_DEF_FG:
case VTE_DEFAULT_FG:
if (foreground != NULL) {
color = *foreground;
} else {
......@@ -2861,21 +2861,21 @@ vte_terminal_set_colors(VteTerminal *terminal,
}
break;
case VTE_BOLD_FG:
vte_terminal_generate_bold(_vte_terminal_get_color(terminal, VTE_DEF_FG),
_vte_terminal_get_color(terminal, VTE_DEF_BG),
vte_terminal_generate_bold(_vte_terminal_get_color(terminal, VTE_DEFAULT_FG),
_vte_terminal_get_color(terminal, VTE_DEFAULT_BG),
1.8,
&color);
break;
case VTE_DIM_FG:
vte_terminal_generate_bold(_vte_terminal_get_color(terminal, VTE_DEF_FG),
_vte_terminal_get_color(terminal, VTE_DEF_BG),
vte_terminal_generate_bold(_vte_terminal_get_color(terminal, VTE_DEFAULT_FG),
_vte_terminal_get_color(terminal, VTE_DEFAULT_BG),
0.5,
&color);
break;
case VTE_DEF_HL:
case VTE_HIGHLIGHT_BG:
unset = TRUE;
break;
case VTE_CUR_BG:
case VTE_CURSOR_BG:
unset = TRUE;
break;
}
......@@ -2928,8 +2928,8 @@ vte_terminal_set_color_bold_rgba(VteTerminal *terminal,
if (bold == NULL)
{
vte_terminal_generate_bold(_vte_terminal_get_color(terminal, VTE_DEF_FG),
_vte_terminal_get_color(terminal, VTE_DEF_BG),
vte_terminal_generate_bold(_vte_terminal_get_color(terminal, VTE_DEFAULT_FG),
_vte_terminal_get_color(terminal, VTE_DEFAULT_BG),
1.8,
&color);
}
......@@ -2959,8 +2959,8 @@ vte_terminal_set_color_dim_rgba(VteTerminal *terminal,
if (dim == NULL)
{
vte_terminal_generate_bold(_vte_terminal_get_color(terminal, VTE_DEF_FG),
_vte_terminal_get_color(terminal, VTE_DEF_BG),
vte_terminal_generate_bold(_vte_terminal_get_color(terminal, VTE_DEFAULT_FG),
_vte_terminal_get_color(terminal, VTE_DEFAULT_BG),
0.5,
&color);
}
......@@ -3231,7 +3231,7 @@ _vte_terminal_cursor_down (VteTerminal *terminal)
}
/* Match xterm and fill the new row when scrolling. */
if (screen->fill_defaults.attr.back != VTE_DEF_BG) {
if (screen->fill_defaults.attr.back != VTE_DEFAULT_BG) {
VteRowData *rowdata;
rowdata = _vte_terminal_ensure_row (terminal);
_vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->column_count);
......@@ -9410,15 +9410,15 @@ vte_terminal_determine_colors_internal(VteTerminal *terminal,
/* Reverse-mode switches default fore and back colors */
if (G_UNLIKELY (terminal->pvt->screen->reverse_mode)) {
if (fore == VTE_DEF_FG)
fore = VTE_DEF_BG;
if (back == VTE_DEF_BG)
back = VTE_DEF_FG;
if (fore == VTE_DEFAULT_FG)
fore = VTE_DEFAULT_BG;
if (back == VTE_DEFAULT_BG)
back = VTE_DEFAULT_FG;
}
/* Handle bold by using set bold color or brightening */
if (cell->attr.bold) {
if (fore == VTE_DEF_FG)
if (fore == VTE_DEFAULT_FG)
fore = VTE_BOLD_FG;
else if (fore >= VTE_LEGACY_COLORS_OFFSET && fore < VTE_LEGACY_COLORS_OFFSET + VTE_LEGACY_COLOR_SET_SIZE) {
fore += VTE_COLOR_BRIGHT_OFFSET;
......@@ -9427,7 +9427,7 @@ vte_terminal_determine_colors_internal(VteTerminal *terminal,
/* Handle half similarly */
if (cell->attr.half) {
if (fore == VTE_DEF_FG)
if (fore == VTE_DEFAULT_FG)
fore = VTE_DIM_FG;
else if (fore >= VTE_LEGACY_COLORS_OFFSET && fore < VTE_LEGACY_COLORS_OFFSET + VTE_LEGACY_COLOR_SET_SIZE)
fore = corresponding_dim_index[fore - VTE_LEGACY_COLORS_OFFSET];
......@@ -9447,8 +9447,8 @@ vte_terminal_determine_colors_internal(VteTerminal *terminal,
/* Selection: use hightlight back, or inverse */
if (selected) {
/* XXX what if hightlight back is same color as current back? */
if (_vte_terminal_get_color(terminal, VTE_DEF_HL) != NULL)
back = VTE_DEF_HL;
if (_vte_terminal_get_color(terminal, VTE_HIGHLIGHT_BG) != NULL)
back = VTE_HIGHLIGHT_BG;
else
swap (&fore, &back);
}
......@@ -9456,8 +9456,8 @@ vte_terminal_determine_colors_internal(VteTerminal *terminal,
/* Cursor: use cursor back, or inverse */
if (cursor) {
/* XXX what if cursor back is same color as current back? */
if (_vte_terminal_get_color(terminal, VTE_CUR_BG) != NULL)
back = VTE_CUR_BG;
if (_vte_terminal_get_color(terminal, VTE_CURSOR_BG) != NULL)
back = VTE_CURSOR_BG;
else
swap (&fore, &back);
}
......@@ -9565,7 +9565,7 @@ vte_terminal_draw_graphic(VteTerminal *terminal, vteunistr c,
width = column_width * columns;
if ((back != VTE_DEF_BG) || draw_default_bg) {
if ((back != VTE_DEFAULT_BG) || draw_default_bg) {
vte_terminal_fill_rectangle(terminal,
&bg,
x, y, width, row_height);
......@@ -10352,7 +10352,7 @@ vte_terminal_draw_cells(VteTerminal *terminal,
items[i].y += terminal->pvt->inner_border.top;
columns += items[i].columns;
}
if (clear && (draw_default_bg || back != VTE_DEF_BG)) {
if (clear && (draw_default_bg || back != VTE_DEFAULT_BG)) {
gint bold_offset = _vte_draw_has_bold(terminal->pvt->draw,
VTE_DRAW_BOLD) ? 0 : bold;
_vte_draw_fill_rectangle(terminal->pvt->draw,
......@@ -10721,7 +10721,7 @@ vte_terminal_draw_rows(VteTerminal *terminal,
bold = cell && cell->attr.bold;
j += cell ? cell->attr.columns : 1;
}
if (back != VTE_DEF_BG) {
if (back != VTE_DEFAULT_BG) {
PangoColor bg;
gint bold_offset = _vte_draw_has_bold(terminal->pvt->draw,
VTE_DRAW_BOLD) ? 0 : bold;
......@@ -10750,7 +10750,7 @@ vte_terminal_draw_rows(VteTerminal *terminal,
j++;
}
vte_terminal_determine_colors(terminal, NULL, selected, &fore, &back);
if (back != VTE_DEF_BG) {
if (back != VTE_DEFAULT_BG) {
PangoColor bg;
vte_terminal_get_rgb_from_index(terminal, back, &bg);
_vte_draw_fill_rectangle (terminal->pvt->draw,
......@@ -13519,7 +13519,7 @@ vte_terminal_background_update(VteTerminal *terminal)
_vte_debug_print(VTE_DEBUG_MISC|VTE_DEBUG_EVENTS,
"Updating background image.\n");
entry = _vte_terminal_get_color(terminal, VTE_DEF_BG);
entry = _vte_terminal_get_color(terminal, VTE_DEFAULT_BG);
_vte_debug_print(VTE_DEBUG_BG,
"Setting background color to (%d, %d, %d, %d).\n",
entry->red, entry->green, entry->blue,
......
......@@ -26,12 +26,12 @@
G_BEGIN_DECLS
#define VTE_DEF_FG 256
#define VTE_DEF_BG 257
#define VTE_DEFAULT_FG 256
#define VTE_DEFAULT_BG 257
#define VTE_BOLD_FG 258
#define VTE_DIM_FG 259
#define VTE_DEF_HL 260
#define VTE_CUR_BG 261
#define VTE_HIGHLIGHT_BG 260
#define VTE_CURSOR_BG 261
#define VTE_PALETTE_SIZE 262
......@@ -110,8 +110,8 @@ static const VteIntCell basic_cell = {
1, /* columns */
0, /* bold */
0, /* italic */
VTE_DEF_FG, /* fore */
VTE_DEF_BG, /* back */
VTE_DEFAULT_FG, /* fore */
VTE_DEFAULT_BG, /* back */
0, /* standout */
0, /* underline */
......
......@@ -1144,7 +1144,7 @@ vte_sequence_handler_cd (VteTerminal *terminal, GValueArray *params)
rowdata = _vte_terminal_ring_append (terminal, FALSE);
}
/* Pad out the row. */
if (screen->fill_defaults.attr.back != VTE_DEF_BG) {
if (screen->fill_defaults.attr.back != VTE_DEFAULT_BG) {
_vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->column_count);
}
rowdata->attr.soft_wrapped = 0;
......@@ -1176,7 +1176,7 @@ vte_sequence_handler_ce (VteTerminal *terminal, GValueArray *params)
/* We've modified the display. Make a note of it. */
terminal->pvt->text_deleted_flag = TRUE;
}
if (screen->fill_defaults.attr.back != VTE_DEF_BG) {
if (screen->fill_defaults.attr.back != VTE_DEFAULT_BG) {
/* Add enough cells to fill out the row. */
_vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->column_count);
}
......@@ -1445,7 +1445,7 @@ vte_sequence_handler_dc (VteTerminal *terminal, GValueArray *params)
/* Remove the column. */
if (col < len) {
_vte_row_data_remove (rowdata, col);
if (screen->fill_defaults.attr.back != VTE_DEF_BG) {
if (screen->fill_defaults.attr.back != VTE_DEFAULT_BG) {
_vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->column_count);
len = terminal->column_count;
}
......@@ -1920,7 +1920,7 @@ vte_sequence_handler_change_color_internal (VteTerminal *terminal, GValueArray *
for (i = 0; pairs[i] && pairs[i + 1]; i += 2) {
idx = strtoul (pairs[i], (char **) NULL, 10);
if (idx >= VTE_DEF_FG)
if (idx >= VTE_DEFAULT_FG)
continue;
if (vte_parse_color (pairs[i + 1], &color)) {
......@@ -1973,13 +1973,13 @@ vte_sequence_handler_reset_color (VteTerminal *terminal, GValueArray *params)
if (!G_VALUE_HOLDS_LONG (value))
continue;
idx = g_value_get_long (value);
if (idx < 0 || idx >= VTE_DEF_FG)
if (idx < 0 || idx >= VTE_DEFAULT_FG)
continue;
_vte_terminal_set_color_internal(terminal, idx, VTE_COLOR_SOURCE_ESCAPE, NULL);
}
} else {
for (idx = 0; idx < VTE_DEF_FG; idx++) {
for (idx = 0; idx < VTE_DEFAULT_FG; idx++) {
_vte_terminal_set_color_internal(terminal, idx, VTE_COLOR_SOURCE_ESCAPE, NULL);
}
}
......@@ -2570,7 +2570,7 @@ vte_sequence_handler_character_attributes (VteTerminal *terminal, GValueArray *p
}
case 39:
/* default foreground */
terminal->pvt->screen->defaults.attr.fore = VTE_DEF_FG;
terminal->pvt->screen->defaults.attr.fore = VTE_DEFAULT_FG;
break;
case 40:
case 41:
......@@ -2585,7 +2585,7 @@ vte_sequence_handler_character_attributes (VteTerminal *terminal, GValueArray *p
/* case 48: was handled above at 38 to avoid code duplication */
case 49:
/* default background */
terminal->pvt->screen->defaults.attr.back = VTE_DEF_BG;
terminal->pvt->screen->defaults.attr.back = VTE_DEFAULT_BG;
break;
case 90:
case 91:
......@@ -3585,7 +3585,7 @@ static void
vte_sequence_handler_change_foreground_color_bel (VteTerminal *terminal, GValueArray *params)
{
vte_sequence_handler_change_special_color_internal (terminal, params,
VTE_DEF_FG, -1, 10, BEL);
VTE_DEFAULT_FG, -1, 10, BEL);
}
/* Change the default foreground cursor, ST terminated */
......@@ -3593,14 +3593,14 @@ static void
vte_sequence_handler_change_foreground_color_st (VteTerminal *terminal, GValueArray *params)
{
vte_sequence_handler_change_special_color_internal (terminal, params,
VTE_DEF_FG, -1, 10, ST);
VTE_DEFAULT_FG, -1, 10, ST);
}
/* Reset the default foreground color */
static void
vte_sequence_handler_reset_foreground_color (VteTerminal *terminal, GValueArray *params)
{
_vte_terminal_set_color_internal(terminal, VTE_DEF_FG, VTE_COLOR_SOURCE_ESCAPE, NULL);
_vte_terminal_set_color_internal(terminal, VTE_DEFAULT_FG, VTE_COLOR_SOURCE_ESCAPE, NULL);
}
/* Change the default background cursor, BEL terminated */
......@@ -3608,7 +3608,7 @@ static void
vte_sequence_handler_change_background_color_bel (VteTerminal *terminal, GValueArray *params)
{
vte_sequence_handler_change_special_color_internal (terminal, params,
VTE_DEF_BG, -1, 11, BEL);
VTE_DEFAULT_BG, -1, 11, BEL);
}
/* Change the default background cursor, ST terminated */
......@@ -3616,14 +3616,14 @@ static void
vte_sequence_handler_change_background_color_st (VteTerminal *terminal, GValueArray *params)
{
vte_sequence_handler_change_special_color_internal (terminal, params,
VTE_DEF_BG, -1, 11, ST);
VTE_DEFAULT_BG, -1, 11, ST);
}
/* Reset the default background color */
static void
vte_sequence_handler_reset_background_color (VteTerminal *terminal, GValueArray *params)
{
_vte_terminal_set_color_internal(terminal, VTE_DEF_BG, VTE_COLOR_SOURCE_ESCAPE, NULL);
_vte_terminal_set_color_internal(terminal, VTE_DEFAULT_BG, VTE_COLOR_SOURCE_ESCAPE, NULL);
}
/* Change the color of the cursor, BEL terminated */
......@@ -3631,7 +3631,7 @@ static void
vte_sequence_handler_change_cursor_color_bel (VteTerminal *terminal, GValueArray *params)
{
vte_sequence_handler_change_special_color_internal (terminal, params,
VTE_CUR_BG, VTE_DEF_FG, 12, BEL);
VTE_CURSOR_BG, VTE_DEFAULT_FG, 12, BEL);
}
/* Change the color of the cursor, ST terminated */
......@@ -3639,14 +3639,14 @@ static void
vte_sequence_handler_change_cursor_color_st (VteTerminal *terminal, GValueArray *params)
{
vte_sequence_handler_change_special_color_internal (terminal, params,
VTE_CUR_BG, VTE_DEF_FG, 12, ST);
VTE_CURSOR_BG, VTE_DEFAULT_FG, 12, ST);
}
/* Reset the color of the cursor */
static void
vte_sequence_handler_reset_cursor_color (VteTerminal *terminal, GValueArray *params)
{
_vte_terminal_set_color_internal(terminal, VTE_CUR_BG, VTE_COLOR_SOURCE_ESCAPE, NULL);
_vte_terminal_set_color_internal(terminal, VTE_CURSOR_BG, VTE_COLOR_SOURCE_ESCAPE, NULL);
}
/* Change the highlight background color, BEL terminated */
......@@ -3654,7 +3654,7 @@ static void
vte_sequence_handler_change_highlight_background_color_bel (VteTerminal *terminal, GValueArray *params)
{
vte_sequence_handler_change_special_color_internal (terminal, params,
VTE_DEF_HL, VTE_DEF_FG, 17, BEL);
VTE_HIGHLIGHT_BG, VTE_DEFAULT_FG, 17, BEL);
}
/* Change the highlight background color, ST terminated */
......@@ -3662,14 +3662,14 @@ static void
vte_sequence_handler_change_highlight_background_color_st (VteTerminal *terminal, GValueArray *params)
{
vte_sequence_handler_change_special_color_internal (terminal, params,
VTE_DEF_HL, VTE_DEF_FG, 17, ST);
VTE_HIGHLIGHT_BG, VTE_DEFAULT_FG, 17, ST);
}
/* Reset the highlight background color */
static void
vte_sequence_handler_reset_highlight_background_color (VteTerminal *terminal, GValueArray *params)
{
_vte_terminal_set_color_internal(terminal, VTE_DEF_HL, VTE_COLOR_SOURCE_ESCAPE, NULL);
_vte_terminal_set_color_internal(terminal, VTE_HIGHLIGHT_BG, VTE_COLOR_SOURCE_ESCAPE, NULL);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment