[gtkhtml] Bug #618368 - Doesn't make all pasted links clickable



commit c57dc6fe1be519cbab925ea693b7a0a6f8b2b9c3
Author: Milan Crha <mcrha redhat com>
Date:   Tue May 11 16:10:10 2010 +0200

    Bug #618368 - Doesn't make all pasted links clickable

 gtkhtml/htmltext.c |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/gtkhtml/htmltext.c b/gtkhtml/htmltext.c
index 1ca512f..16c152b 100644
--- a/gtkhtml/htmltext.c
+++ b/gtkhtml/htmltext.c
@@ -3234,13 +3234,21 @@ html_text_magic_link (HTMLText *text, HTMLEngine *engine, guint offset)
 		str = g_utf8_next_char (str);
 
 	if (exec) {
-		for (i = 0; i < G_N_ELEMENTS (mim); i++) {
-			if (mim [i].preg && !regexec (mim [i].preg, str, 2, pmatch, 0)) {
-				paste_link (engine, text,
-					    g_utf8_pointer_to_offset (text->text, str + pmatch [0].rm_so),
-					    g_utf8_pointer_to_offset (text->text, str + pmatch [0].rm_eo), mim [i].prefix);
-					rv = TRUE;
-					break;
+		gboolean done = FALSE;
+		guint32 str_offset = 0, str_length = strlen (str);
+
+		while (!done) {
+			done = TRUE;
+			for (i = 0; i < G_N_ELEMENTS (mim); i++) {
+				if (mim [i].preg && !regexec (mim [i].preg, str + str_offset, 2, pmatch, 0)) {
+					paste_link (engine, text,
+						    g_utf8_pointer_to_offset (text->text, str + str_offset + pmatch [0].rm_so),
+						    g_utf8_pointer_to_offset (text->text, str + str_offset + pmatch [0].rm_eo), mim [i].prefix);
+						rv = TRUE;
+						str_offset += pmatch [0].rm_eo + 1;
+						done = str_offset >= str_length;
+						break;
+				}
 			}
 		}
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]