gnome-mud r828 - in trunk: . src
- From: lharris svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-mud r828 - in trunk: . src
- Date: Sun, 22 Mar 2009 04:48:29 +0000 (UTC)
Author: lharris
Date: Sun Mar 22 04:48:29 2009
New Revision: 828
URL: http://svn.gnome.org/viewvc/gnome-mud?rev=828&view=rev
Log:
MudLog ECMA parser now handles xterm colors 0-15 properly.
Modified:
trunk/ChangeLog
trunk/src/mud-log.c
Modified: trunk/src/mud-log.c
==============================================================================
--- trunk/src/mud-log.c (original)
+++ trunk/src/mud-log.c Sun Mar 22 04:48:29 2009
@@ -145,6 +145,7 @@
gint ecma_code);
static void mud_log_write_html_background_span(MudLog *self,
GString *output,
+ gboolean bold,
gint ecma_code);
static void mud_log_write_html_xterm_span(MudLog *self,
GString *output,
@@ -1139,48 +1140,56 @@
case ECMA_BACKCOLOR_BLACK:
mud_log_write_html_background_span(self,
output,
+ FALSE,
ECMA_BACKCOLOR_BLACK);
break;
case ECMA_BACKCOLOR_RED:
mud_log_write_html_background_span(self,
output,
+ FALSE,
ECMA_BACKCOLOR_RED);
break;
case ECMA_BACKCOLOR_GREEN:
mud_log_write_html_background_span(self,
output,
+ FALSE,
ECMA_BACKCOLOR_GREEN);
break;
case ECMA_BACKCOLOR_YELLOW:
mud_log_write_html_background_span(self,
output,
+ FALSE,
ECMA_BACKCOLOR_YELLOW);
break;
case ECMA_BACKCOLOR_BLUE:
mud_log_write_html_background_span(self,
output,
+ FALSE,
ECMA_BACKCOLOR_BLUE);
break;
case ECMA_BACKCOLOR_MAGENTA:
mud_log_write_html_background_span(self,
output,
+ FALSE,
ECMA_BACKCOLOR_MAGENTA);
break;
case ECMA_BACKCOLOR_CYAN:
mud_log_write_html_background_span(self,
output,
+ FALSE,
ECMA_BACKCOLOR_CYAN);
break;
case ECMA_BACKCOLOR_WHITE:
mud_log_write_html_background_span(self,
output,
+ FALSE,
ECMA_BACKCOLOR_WHITE);
break;
@@ -1270,48 +1279,56 @@
case ECMA_BACKCOLOR_BLACK:
mud_log_write_html_background_span(self,
output,
+ FALSE,
ECMA_BACKCOLOR_BLACK);
break;
case ECMA_BACKCOLOR_RED:
mud_log_write_html_background_span(self,
output,
+ FALSE,
ECMA_BACKCOLOR_RED);
break;
case ECMA_BACKCOLOR_GREEN:
mud_log_write_html_background_span(self,
output,
+ FALSE,
ECMA_BACKCOLOR_GREEN);
break;
case ECMA_BACKCOLOR_YELLOW:
mud_log_write_html_background_span(self,
output,
+ FALSE,
ECMA_BACKCOLOR_YELLOW);
break;
case ECMA_BACKCOLOR_BLUE:
mud_log_write_html_background_span(self,
output,
+ FALSE,
ECMA_BACKCOLOR_BLUE);
break;
case ECMA_BACKCOLOR_MAGENTA:
mud_log_write_html_background_span(self,
output,
+ FALSE,
ECMA_BACKCOLOR_MAGENTA);
break;
case ECMA_BACKCOLOR_CYAN:
mud_log_write_html_background_span(self,
output,
+ FALSE,
ECMA_BACKCOLOR_CYAN);
break;
case ECMA_BACKCOLOR_WHITE:
mud_log_write_html_background_span(self,
output,
+ FALSE,
ECMA_BACKCOLOR_WHITE);
break;
@@ -1411,6 +1428,7 @@
static void
mud_log_write_html_background_span(MudLog *self,
GString *output,
+ gboolean bold,
gint ecma_code)
{
gint color_index = ecma_code - 40;
@@ -1435,6 +1453,8 @@
break;
}
+ color_index += (bold) ? 8 : 0;
+
g_string_append_printf(output, "<span style=\"background-color: rgb(%d, %d, %d);\">",
self->priv->parent->profile->preferences->Colors[color_index].red / 256,
self->priv->parent->profile->preferences->Colors[color_index].blue / 256,
@@ -1450,9 +1470,30 @@
{
gchar *css_color;
- if(color < 16 || color > 255)
+ if(color > 255)
return;
+ if(color < 16) // Drop back down to the standard ECMA-48 colors.
+ {
+ gboolean bolded = (color > 7);
+
+ if(bolded)
+ color -= 8;
+
+ if(foreground)
+ mud_log_write_html_foreground_span(self,
+ output,
+ bolded,
+ color + 30);
+ else
+ mud_log_write_html_background_span(self,
+ output,
+ bolded, // xterm can have bolded backgrounds.
+ color + 40);
+
+ return;
+ }
+
if(foreground)
css_color = g_strdup("color: ");
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]