--- a/mcabber/src/utils.c Sat Feb 14 17:30:00 2009 +0100
+++ b/mcabber/src/utils.c Tue Mar 10 20:44:16 2009 +0100
@@ -495,7 +495,7 @@
// string after use.
char *ut_expand_tabs(const char *text)
{
- char *xtext;
+ char *xtext, *linestart;
char *p, *q;
guint n = 0, bc = 0;
@@ -512,12 +512,14 @@
xtext = g_new(char, strlen(text) + 1 + 8*n);
p = (char*)text;
- q = xtext;
+ q = linestart = xtext;
do {
if (*p == '\t') {
- do { *q++ = ' '; } while ((q-xtext)%8);
+ do { *q++ = ' '; } while ((q-linestart)%8);
} else if (*p != '\x0d') {
*q++ = *p;
+ if (*p =='\n')
+ linestart = q;
}
} while (*p++);