Mercurial > pidgin.yaz
comparison src/gtkimhtml.c @ 10217:6f49ce1d394d
[gaim-migrate @ 11345]
Daniel Westermann-Clark wrote a patch so we wouldn't insert spaces after
br tags, because that's bad. This is it.
I consider this, and what Sean did to cause it, hacks, but then I don't
feel like making us deal with whitespace better (which probably involves
implementing some style properties or something).
I wonder if Mr. Westermann-Clark goes under W or C.
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Sat, 20 Nov 2004 06:03:21 +0000 |
parents | f6918ab1624a |
children | e450f24d1fe1 |
comparison
equal
deleted
inserted
replaced
10216:09876d57c520 | 10217:6f49ce1d394d |
---|---|
2007 sub = 0, | 2007 sub = 0, |
2008 sup = 0, | 2008 sup = 0, |
2009 title = 0, | 2009 title = 0, |
2010 pre = 0; | 2010 pre = 0; |
2011 | 2011 |
2012 gboolean br = FALSE; | |
2013 | |
2012 GSList *fonts = NULL; | 2014 GSList *fonts = NULL; |
2013 GObject *object; | 2015 GObject *object; |
2014 GtkIMHtmlScalable *scalable = NULL; | 2016 GtkIMHtmlScalable *scalable = NULL; |
2015 | 2017 |
2016 g_return_if_fail (imhtml != NULL); | 2018 g_return_if_fail (imhtml != NULL); |
2024 while (pos < len) { | 2026 while (pos < len) { |
2025 if (*c == '<' && gtk_imhtml_is_tag (c + 1, &tag, &tlen, &type)) { | 2027 if (*c == '<' && gtk_imhtml_is_tag (c + 1, &tag, &tlen, &type)) { |
2026 c++; | 2028 c++; |
2027 pos++; | 2029 pos++; |
2028 ws[wpos] = '\0'; | 2030 ws[wpos] = '\0'; |
2031 br = FALSE; | |
2029 switch (type) | 2032 switch (type) |
2030 { | 2033 { |
2031 case 1: /* B */ | 2034 case 1: /* B */ |
2032 case 2: /* BOLD */ | 2035 case 2: /* BOLD */ |
2033 case 54: /* STRONG */ | 2036 case 54: /* STRONG */ |
2147 case 25: /* BR */ | 2150 case 25: /* BR */ |
2148 case 58: /* BR/ */ | 2151 case 58: /* BR/ */ |
2149 case 61: /* BR (opt) */ | 2152 case 61: /* BR (opt) */ |
2150 ws[wpos] = '\n'; | 2153 ws[wpos] = '\n'; |
2151 wpos++; | 2154 wpos++; |
2155 br = TRUE; | |
2152 break; | 2156 break; |
2153 case 26: /* HR */ | 2157 case 26: /* HR */ |
2154 case 42: /* HR (opt) */ | 2158 case 42: /* HR (opt) */ |
2155 { | 2159 { |
2156 int minus; | 2160 int minus; |
2557 wpos++; | 2561 wpos++; |
2558 gtk_text_buffer_insert(imhtml->text_buffer, iter, ws, wpos); | 2562 gtk_text_buffer_insert(imhtml->text_buffer, iter, ws, wpos); |
2559 ws[0] = '\0'; | 2563 ws[0] = '\0'; |
2560 wpos = 0; | 2564 wpos = 0; |
2561 /* NEW_BIT (NEW_TEXT_BIT); */ | 2565 /* NEW_BIT (NEW_TEXT_BIT); */ |
2562 } else { | 2566 } else if (!br) { /* Don't insert a space immediately after an HTML break */ |
2563 /* A newline is defined by HTML as whitespace, which means we have to replace it with a word boundary. | 2567 /* A newline is defined by HTML as whitespace, which means we have to replace it with a word boundary. |
2564 * word breaks vary depending on the language used, so the correct thing to do is to use Pango to determine | 2568 * word breaks vary depending on the language used, so the correct thing to do is to use Pango to determine |
2565 * what language this is, determine the proper word boundary to use, and insert that. I'm just going to insert | 2569 * what language this is, determine the proper word boundary to use, and insert that. I'm just going to insert |
2566 * a space instead. What are the non-English speakers going to do? Complain in a language I'll understand? | 2570 * a space instead. What are the non-English speakers going to do? Complain in a language I'll understand? |
2567 * Bu-wahaha! */ | 2571 * Bu-wahaha! */ |