| 80 str = g_string_new(NULL); |
80 str = g_string_new(NULL); |
| 81 |
81 |
| 82 while (*start) { |
82 while (*start) { |
| 83 if ((end = strchr(start, '\n')) != NULL || |
83 if ((end = strchr(start, '\n')) != NULL || |
| 84 (end = strchr(start, '\r')) != NULL) { |
84 (end = strchr(start, '\r')) != NULL) { |
| 85 if (gnt_util_onscreen_width(start, end) <= maxw) { |
85 if (gnt_util_onscreen_width(start, end) > maxw) |
| 86 ++end; |
|
| 87 } else |
|
| 88 end = NULL; |
86 end = NULL; |
| 89 } |
87 } |
| 90 if (end == NULL) |
88 if (end == NULL) |
| 91 end = gnt_util_onscreen_width_to_pointer(start, maxw, NULL); |
89 end = gnt_util_onscreen_width_to_pointer(start, maxw, NULL); |
| 92 str = g_string_append_len(str, start, end - start); |
90 str = g_string_append_len(str, start, end - start); |
| |
91 if (*end) { |
| |
92 str = g_string_append_c(str, '\n'); |
| |
93 if (*end == '\n' || *end == '\r') |
| |
94 end++; |
| |
95 } |
| 93 start = end; |
96 start = end; |
| 94 if (*end && *end != '\n' && *end != '\r') |
|
| 95 str = g_string_append_c(str, '\n'); |
|
| 96 } |
97 } |
| 97 return g_string_free(str, FALSE); |
98 return g_string_free(str, FALSE); |
| 98 } |
99 } |
| 99 |
100 |