changeset 15311:e9963b2cfcaf

[gaim-migrate @ 18101] Change some of the stuff here. This may or may not fix the bug regarding incoming typing notifications. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 11 Jan 2007 03:56:44 +0000
parents 82a2e909e10e
children 4e004a29ccf3
files console/libgnt/gnttextview.c
diffstat 1 files changed, 24 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/console/libgnt/gnttextview.c	Wed Jan 10 22:16:26 2007 +0000
+++ b/console/libgnt/gnttextview.c	Thu Jan 11 03:56:44 2007 +0000
@@ -542,28 +542,39 @@
 					GntTextSegment *seg = segs->data;
 					snext = segs->next;
 					if (seg->start >= tag->end) {
+						/* The segment is somewhere after the tag */
 						seg->start -= change;
 						seg->end -= change;
-						continue;
+					} else if (seg->end <= tag->start) {
+						/* This segment is somewhere in front of the tag */
+					} else if (seg->start >= tag->start) {
+						/* This segment starts in the middle of the tag */
+						if (text == NULL) {
+							free_text_segment(seg, NULL);
+							line->segments = g_list_delete_link(line->segments, segs);
+							if (line->segments == NULL) {
+								free_text_line(line, NULL);
+								view->list = g_list_delete_link(view->list, iter);
+							}
+						} else {
+							/* XXX: (null) */
+							seg->start = tag->start;
+							seg->end = tag->end - change;
+						}
+						line->length -= change;
+						/* XXX: Make things work if the tagged text spans over several lines. */
+					} else {
+						/* XXX: handle the rest of the conditions */
+						g_printerr("WTF! This needs to be handled properly!!\n");
 					}
-					if (seg->end < tag->start)
-						continue;
-					
-					if (seg->start >= tag->start && seg->end <= tag->end) {
-						free_text_segment(seg, NULL);
-						line->segments = g_list_delete_link(line->segments, segs);
-						if (line->segments == NULL) {
-							free_text_line(line, NULL);
-							view->list = g_list_delete_link(view->list, iter);
-						}
-					}
-					/* XXX: handle the rest of the conditions */
 				}
 			}
 			if (text == NULL) {
 				/* Remove the tag */
 				view->tags = g_list_delete_link(view->tags, list);
 				free_tag(tag, NULL);
+			} else {
+				tag->end -= change;
 			}
 			if (!all)
 				break;