Revision 76ae821b860d7d88ecac474faf4c7d8784b674b9
wabz at pidgin.im
wabz at pidgin.im
Mon Apr 9 06:05:31 EDT 2007
o -----------------------------------------------------------------
| Revision: 76ae821b860d7d88ecac474faf4c7d8784b674b9
| Ancestor: d064a7734e5f0180f59fd1a438a5cd4d5800d02d
| Author: wabz at pidgin.im
| Date: 2007-04-09T10:03:48
| Branch: im.pidgin.pidgin
|
| Modified files:
| finch/libgnt/gnttextview.c
|
| ChangeLog:
|
| word wrapping, fix \r\n newlines
|
| ============================================================
| --- finch/libgnt/gnttextview.c 975e869d7fce95b488bedffd75dc7fd97d0a1ab5
| +++ finch/libgnt/gnttextview.c f2c4760847c562fa691882d4c87735cdc3ce52a6
| @@ -483,9 +483,12 @@ void gnt_text_view_append_text_with_tag(
| start = end = view->string->str + len;
|
| while (*start) {
| + GntTextLine *oldl;
| GntTextSegment *seg = NULL;
|
| if (*end == '\n' || *end == '\r') {
| + if (!strncmp(end, "\r\n", 2))
| + end++;
| end++;
| start = end;
| gnt_text_view_next_line(view);
| @@ -501,8 +504,8 @@ void gnt_text_view_append_text_with_tag(
| view->list = g_list_prepend(view->list, line);
| }
|
| - if ((end = strchr(start, '\n')) != NULL ||
| - (end = strchr(start, '\r')) != NULL) {
| + if ((end = strchr(start, '\r')) != NULL ||
| + (end = strchr(start, '\n')) != NULL) {
| len = gnt_util_onscreen_width(start, end - 1);
| if (len >= widget->priv.width - line->length - 1) {
| end = NULL;
| @@ -527,15 +530,25 @@ void gnt_text_view_append_text_with_tag(
| seg->flags = fl;
| line->segments = g_list_append(line->segments, seg);
| }
| - seg->end = end - view->string->str;
| - line->length += len;
|
| - start = end;
| + oldl = line;
| if (*end && *end != '\n' && *end != '\r') {
| + const char *tmp = end;
| + while (end && *end != '\n' && *end != '\r' && !g_ascii_isspace(*end)) {
| + end = g_utf8_find_prev_char(seg->start + view->string->str, end);
| + }
| + if (!end || !g_ascii_isspace(*end))
| + end = tmp;
| + else
| + end++; /* Remove the space */
| +
| line = g_new0(GntTextLine, 1);
| line->soft = TRUE;
| view->list = g_list_prepend(view->list, line);
| }
| + seg->end = end - view->string->str;
| + oldl->length += len;
| + start = end;
| }
|
| view->list = list;
To get the patch for this revision, please do this:
mtn log --last 1 --diffs --from 76ae821b860d7d88ecac474faf4c7d8784b674b9
More information about the Commits
mailing list