equal
deleted
inserted
replaced
1666 |
1666 |
1667 static bool DrawScrollingStatusText(const NewsItem *ni, int pos, int width) |
1667 static bool DrawScrollingStatusText(const NewsItem *ni, int pos, int width) |
1668 { |
1668 { |
1669 char buf[512]; |
1669 char buf[512]; |
1670 StringID str; |
1670 StringID str; |
1671 const char *s; |
1671 const char *s, *last; |
1672 char *d; |
1672 char *d; |
1673 DrawPixelInfo tmp_dpi, *old_dpi; |
1673 DrawPixelInfo tmp_dpi, *old_dpi; |
1674 int x; |
1674 int x; |
1675 char buffer[256]; |
1675 char buffer[256]; |
1676 |
1676 |
1683 |
1683 |
1684 GetString(buf, str, lastof(buf)); |
1684 GetString(buf, str, lastof(buf)); |
1685 |
1685 |
1686 s = buf; |
1686 s = buf; |
1687 d = buffer; |
1687 d = buffer; |
|
1688 last = lastof(buffer); |
1688 |
1689 |
1689 for (;;) { |
1690 for (;;) { |
1690 WChar c = Utf8Consume(&s); |
1691 WChar c = Utf8Consume(&s); |
1691 if (c == 0) { |
1692 if (c == 0) { |
1692 *d = '\0'; |
|
1693 break; |
1693 break; |
1694 } else if (*s == 0x0D) { |
1694 } else if (c == 0x0D) { |
|
1695 if (d + 4 >= last) break; |
1695 d[0] = d[1] = d[2] = d[3] = ' '; |
1696 d[0] = d[1] = d[2] = d[3] = ' '; |
1696 d += 4; |
1697 d += 4; |
1697 } else if (IsPrintable(c)) { |
1698 } else if (IsPrintable(c)) { |
|
1699 if (d + Utf8CharLen(c) >= last) break; |
1698 d += Utf8Encode(d, c); |
1700 d += Utf8Encode(d, c); |
1699 } |
1701 } |
1700 } |
1702 } |
|
1703 *d = '\0'; |
1701 |
1704 |
1702 if (!FillDrawPixelInfo(&tmp_dpi, 141, 1, width, 11)) return true; |
1705 if (!FillDrawPixelInfo(&tmp_dpi, 141, 1, width, 11)) return true; |
1703 |
1706 |
1704 old_dpi = _cur_dpi; |
1707 old_dpi = _cur_dpi; |
1705 _cur_dpi = &tmp_dpi; |
1708 _cur_dpi = &tmp_dpi; |