summary refs log tree commit diff stats
path: root/src/fe-gtk/xtext.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fe-gtk/xtext.c')
-rw-r--r--src/fe-gtk/xtext.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/fe-gtk/xtext.c b/src/fe-gtk/xtext.c
index 418bb4da..6a0fccba 100644
--- a/src/fe-gtk/xtext.c
+++ b/src/fe-gtk/xtext.c
@@ -433,6 +433,7 @@ gtk_xtext_init (GtkXText * xtext)
 	xtext->nc = 0;
 	xtext->pixel_offset = 0;
 	xtext->underline = FALSE;
+	xtext->strikethrough = FALSE;
 	xtext->hidden = FALSE;
 	xtext->font = NULL;
 	xtext->layout = NULL;
@@ -2451,6 +2452,7 @@ gtk_xtext_strip_color (unsigned char *text, int len, unsigned char *outbuf,
 			case ATTR_REVERSE:
 			case ATTR_BOLD:
 			case ATTR_UNDERLINE:
+			case ATTR_STRIKETHROUGH:
 			case ATTR_ITALICS:
 				xtext_do_chunk (&c);
 				if (*text == ATTR_RESET)
@@ -2627,6 +2629,13 @@ gtk_xtext_render_flush (GtkXText * xtext, int x, int y, unsigned char *str,
 		g_object_unref (pix);
 	}
 
+	if (xtext->strikethrough)
+	{
+		/* pango_attr_strikethrough_new does not render in the custom widget so we need to reinvent the wheel */
+		y = dest_y + (xtext->fontsize / 2);
+		gdk_draw_line (xtext->draw_buf, gc, dest_x, y, dest_x + str_width - 1, y);
+	}
+
 	if (xtext->underline)
 	{
 dounder:
@@ -2651,6 +2660,7 @@ gtk_xtext_reset (GtkXText * xtext, int mark, int attribs)
 	if (attribs)
 	{
 		xtext->underline = FALSE;
+		xtext->strikethrough = FALSE;
 		xtext->hidden = FALSE;
 	}
 	if (!mark)
@@ -2961,6 +2971,12 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
 				pstr += j + 1;
 				j = 0;
 				break;
+			case ATTR_STRIKETHROUGH:
+				RENDER_FLUSH;
+				xtext->strikethrough = !xtext->strikethrough;
+				pstr += j + 1;
+				j = 0;
+				break;
 			case ATTR_ITALICS:
 				RENDER_FLUSH;
 				*emphasis ^= EMPH_ITAL;
@@ -3191,6 +3207,7 @@ find_next_wrap (GtkXText * xtext, textentry * ent, unsigned char *str,
 			case ATTR_REVERSE:
 			case ATTR_BOLD:
 			case ATTR_UNDERLINE:
+			case ATTR_STRIKETHROUGH:
 			case ATTR_ITALICS:
 				if (*str == ATTR_RESET)
 					emphasis = 0;