Mercurial > pidgin.yaz
comparison console/libgnt/gnttextview.c @ 15314:508e64b12d98
[gaim-migrate @ 18104]
How about now?
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Thu, 11 Jan 2007 06:21:46 +0000 |
parents | e9963b2cfcaf |
children | fa49e24d24f3 |
comparison
equal
deleted
inserted
replaced
15313:c273952a004d | 15314:508e64b12d98 |
---|---|
505 /** | 505 /** |
506 * XXX: There are quite possibly more than a few bugs here. | 506 * XXX: There are quite possibly more than a few bugs here. |
507 */ | 507 */ |
508 int gnt_text_view_tag_change(GntTextView *view, const char *name, const char *text, gboolean all) | 508 int gnt_text_view_tag_change(GntTextView *view, const char *name, const char *text, gboolean all) |
509 { | 509 { |
510 GList *alllines = g_list_first(view->list); | |
510 GList *list, *next, *iter, *inext; | 511 GList *list, *next, *iter, *inext; |
511 int count = 0; | 512 int count = 0; |
512 for (list = view->tags; list; list = next) { | 513 for (list = view->tags; list; list = next) { |
513 GntTextTag *tag = list->data; | 514 GntTextTag *tag = list->data; |
514 next = list->next; | 515 next = list->next; |
532 t->start -= change; | 533 t->start -= change; |
533 t->end -= change; | 534 t->end -= change; |
534 } | 535 } |
535 | 536 |
536 /* Update the offsets of the segments */ | 537 /* Update the offsets of the segments */ |
537 for (iter = view->list; iter; iter = inext) { | 538 for (iter = alllines; iter; iter = inext) { |
538 GList *segs, *snext; | 539 GList *segs, *snext; |
539 GntTextLine *line = iter->data; | 540 GntTextLine *line = iter->data; |
540 inext = iter->next; | 541 inext = iter->next; |
541 for (segs = line->segments; segs; segs = snext) { | 542 for (segs = line->segments; segs; segs = snext) { |
542 GntTextSegment *seg = segs->data; | 543 GntTextSegment *seg = segs->data; |
552 if (text == NULL) { | 553 if (text == NULL) { |
553 free_text_segment(seg, NULL); | 554 free_text_segment(seg, NULL); |
554 line->segments = g_list_delete_link(line->segments, segs); | 555 line->segments = g_list_delete_link(line->segments, segs); |
555 if (line->segments == NULL) { | 556 if (line->segments == NULL) { |
556 free_text_line(line, NULL); | 557 free_text_line(line, NULL); |
557 view->list = g_list_delete_link(view->list, iter); | 558 if (view->list == iter) { |
559 if (inext) | |
560 view->list = inext; | |
561 else | |
562 view->list = iter->prev; | |
563 } | |
564 alllines = g_list_delete_link(alllines, iter); | |
558 } | 565 } |
559 } else { | 566 } else { |
560 /* XXX: (null) */ | 567 /* XXX: (null) */ |
561 seg->start = tag->start; | 568 seg->start = tag->start; |
562 seg->end = tag->end - change; | 569 seg->end = tag->end - change; |