McKael / mcabber (http://mcabber.com)
Mirror of the mcabber upstream repository. MCabber is a small Jabber console client.
| commit 1568: | e89787ee40f7 |
| parent 1567: | 48c2060845ac |
| branch: | default |
Fix tab expansion when using say_to -f
Changed (Δ72 bytes):
raw changeset »
mcabber/src/utils.c (5 lines added, 3 lines removed)
Up to file-list mcabber/src/utils.c:
| … | … | @@ -495,7 +495,7 @@ void replace_nl_with_dots(char *bufstr) |
495 |
495 |
// string after use. |
496 |
496 |
char *ut_expand_tabs(const char *text) |
497 |
497 |
{ |
498 |
char *xtext |
|
498 |
char *xtext, *linestart; |
|
499 |
499 |
char *p, *q; |
500 |
500 |
guint n = 0, bc = 0; |
501 |
501 |
|
| … | … | @@ -512,12 +512,14 @@ char *ut_expand_tabs(const char *text) |
512 |
512 |
|
513 |
513 |
xtext = g_new(char, strlen(text) + 1 + 8*n); |
514 |
514 |
p = (char*)text; |
515 |
q = |
|
515 |
q = linestart = xtext; |
|
516 |
516 |
do { |
517 |
517 |
if (*p == '\t') { |
518 |
do { *q++ = ' '; } while ((q- |
|
518 |
do { *q++ = ' '; } while ((q-linestart)%8); |
|
519 |
519 |
} else if (*p != '\x0d') { |
520 |
520 |
*q++ = *p; |
521 |
if (*p =='\n') |
|
522 |
linestart = q; |
|
521 |
523 |
} |
522 |
524 |
} while (*p++); |
523 |
525 |
