Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/screen.c @ 727:1c3620668857
Expand tabs when reading history files
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sun, 05 Mar 2006 22:29:14 +0100 |
parents | 51be2bc1a820 |
children | 421b337dc6d2 |
comparison
equal
deleted
inserted
replaced
726:51be2bc1a820 | 727:1c3620668857 |
---|---|
976 } | 976 } |
977 | 977 |
978 inline void scr_WriteMessage(const char *jid, const char *text, | 978 inline void scr_WriteMessage(const char *jid, const char *text, |
979 time_t timestamp, guint prefix_flags) | 979 time_t timestamp, guint prefix_flags) |
980 { | 980 { |
981 char *p, *xtext; | 981 char *xtext; |
982 guint8 n =0; | |
983 | 982 |
984 if (!timestamp) timestamp = time(NULL); | 983 if (!timestamp) timestamp = time(NULL); |
985 | 984 |
986 xtext = (char*)text; | 985 xtext = ut_expand_tabs(text); // Expand tabs |
987 | |
988 // Expand tabs | |
989 for (p=xtext; *p; p++) | |
990 if (*p == '\t') n++; | |
991 if (n) { | |
992 char *q; | |
993 xtext = g_new(char, strlen(text) + 1 + 8*n); | |
994 p = (char*)text; | |
995 q = xtext; | |
996 do { | |
997 if (*p == '\t') { | |
998 do { *q++ = ' '; } while ((q-xtext)%8); | |
999 } else { | |
1000 *q++ = *p; | |
1001 } | |
1002 } while (*p++); | |
1003 } | |
1004 | 986 |
1005 // XXX Are there other special chars we should filter out? | 987 // XXX Are there other special chars we should filter out? |
1006 | 988 |
1007 scr_WriteInWindow(jid, xtext, timestamp, prefix_flags, FALSE); | 989 scr_WriteInWindow(jid, xtext, timestamp, prefix_flags, FALSE); |
1008 | 990 |