don't handle format char at end.

fix https://gna.org/bugs/?7197
This commit is contained in:
Serge Martin 2006-09-28 10:46:57 +00:00
parent 4baf20104a
commit 7ab1f545f0
3 changed files with 11 additions and 3 deletions

View file

@ -139,7 +139,7 @@ std::string::const_iterator parse_markup(std::string::const_iterator i1, std::st
}
// Copy string but without tags at the begining
// Copy string but without tags at the begining
std::string del_tags(std::string name){
std::stringstream str;
bool not_colour = true;
@ -165,7 +165,7 @@ std::string del_tags(std::string name){
if (not_name && isalpha(*it)){
not_name = false;
}
if (!not_name){
str << *it;
}
@ -355,7 +355,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();