don't handle format char at end.

fix https://gna.org/bugs/?7197
This commit is contained in:
Serge Martin 2006-09-28 10:49:42 +00:00
parent 1efa0c0ece
commit b7be47d0ba
3 changed files with 9 additions and 1 deletions

View file

@ -317,7 +317,7 @@ std::string word_wrap_text(const std::string& unwrapped_text, int font_size, int
if(start_of_line) {
line_width = 0;
format_string = "";
while(ch != end && *ch < (wchar_t)0x100 && is_format_char(*ch)) {
while(ch != end && *ch < (wchar_t)0x100 && is_format_char(*ch) && !ch.next_is_end()) {
format_string.append(ch.substr().first, ch.substr().second);
++ch;
}

View file

@ -437,6 +437,13 @@ wchar_t utf8_iterator::operator*() const
return current_char;
}
bool utf8_iterator::next_is_end()
{
if(current_substr.second == string_end)
return true;
return false;
}
const std::pair<std::string::const_iterator, std::string::const_iterator>& utf8_iterator::substr() const
{
return current_substr;

View file

@ -96,6 +96,7 @@ public:
bool operator!=(const utf8_iterator& a) const { return ! (*this == a); }
utf8_iterator& operator++();
wchar_t operator*() const;
bool next_is_end();
const std::pair<std::string::const_iterator, std::string::const_iterator>& substr() const;
private:
void update();