summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorFarow <farow_spam@lavabit.com>2013-10-04 15:00:07 +0300
committerTingPing <tingping@tingping.se>2013-10-04 12:17:46 -0400
commit4ec0e6fd0525cca22fb28e80caf0c5b473c965b1 (patch)
tree6c5835029722b8e359ab75432e93c9b7aa897383
parenta47740636d5b91895cc68f8cd7b8e3caaa10ee14 (diff)
libsexy: Improve color parsing
- Background colour is only parsed when there's a comma
- Offset for background color is incorrectly calculated (there's no
control character, just a comma)
-rw-r--r--src/fe-gtk/sexy-spell-entry.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/fe-gtk/sexy-spell-entry.c b/src/fe-gtk/sexy-spell-entry.c
index 85d050d8..42d47127 100644
--- a/src/fe-gtk/sexy-spell-entry.c
+++ b/src/fe-gtk/sexy-spell-entry.c
@@ -950,6 +950,10 @@ check_color:
 					parsing_color = 5;
 			}
 
+			/* don't parse background color without a comma */
+			else if (parsing_color == 3 && text[i - 1] != ',')
+				parsing_color = 5;
+
 			switch (parsing_color)
 			{
 			case 1:
@@ -965,7 +969,7 @@ check_color:
 			case 3:
 				bg_color[0] = text[i];
 				parsing_color++;
-				bg_offset = 3 + fg_offset; /* 1 extra for , */
+				bg_offset = 2 + fg_offset; /* 1 extra for , */
 				continue;
 			case 4:
 				bg_color[1] = text[i];