Fix bug #6649 - fix texrow structure generated by InsetIndex

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34181 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Pavel Sanda 2010-04-16 23:47:39 +00:00
parent cfffdd92aa
commit e45427de38
3 changed files with 23 additions and 1 deletions

View File

@ -152,15 +152,19 @@ int InsetIndex::latex(odocstream & os,
subst(spart2, from_ascii("\\"), docstring());
os << ppart;
os << '@';
i += count_char(ppart, '\n');
}
docstring const tpart = *it;
os << tpart;
i += count_char(tpart, '\n');
if (it2 < levels_plain.end())
++it2;
}
// write the bit that followed "|"
if (!cmd.empty())
if (!cmd.empty()) {
os << "|" << cmd;
i += count_char(cmd, '\n');
}
os << '}';
return i;
}

View File

@ -666,6 +666,7 @@ basic_string<Ch> const subst_char(basic_string<Ch> const & a,
return tmp;
}
/// Substitute all \a oldchar with \a newchar
docstring const subst_char(docstring const & a,
docstring::value_type oldchar, docstring::value_type newchar)
@ -697,6 +698,7 @@ String const subst_string(String const & a,
return lstr;
}
docstring const subst_string(docstring const & a,
docstring const & oldstr, docstring const & newstr)
{
@ -742,6 +744,19 @@ docstring const subst(docstring const & a,
}
/// Count all occurences of char \a chr inside \a str
int count_char(docstring const & str, docstring::value_type chr)
{
int count = 0;
docstring::const_iterator lit = str.begin();
docstring::const_iterator end = str.end();
for (; lit != end; ++lit)
if ((*lit) == chr)
count++;
return count;
}
docstring const trim(docstring const & a, char const * p)
{
LASSERT(p, /**/);

View File

@ -173,6 +173,9 @@ std::string const subst(std::string const & a,
docstring const subst(docstring const & a,
docstring const & oldstr, docstring const & newstr);
/// Count all occurences of char \a chr inside \a str
int count_char(docstring const & str, docstring::value_type chr);
/** Trims characters off the end and beginning of a string.
\code
trim("ccabccc", "c") == "ab".