diff --git a/src/plaintolatexconverter.h b/src/plaintolatexconverter.h --- a/src/plaintolatexconverter.h +++ b/src/plaintolatexconverter.h @@ -22,6 +22,7 @@ #include #include +#include /** * A class that replaces the selection in the document (plain text) by its diff --git a/src/plaintolatexconverter.cpp b/src/plaintolatexconverter.cpp --- a/src/plaintolatexconverter.cpp +++ b/src/plaintolatexconverter.cpp @@ -44,22 +44,8 @@ QString PlainToLaTeXConverter::ConvertToLaTeX(const QString& toConv) const { QString result(toConv); - - // Replacing what must be... - uint sSize = result.length(); - QMap::const_iterator mapEnd = m_replaceMap.end(); - for(uint i = 0 ; i < sSize ; ++i) - { - QMap::const_iterator it = m_replaceMap.find(result.at(i)); - - if(it != mapEnd) { // The character must be replaced - result.replace(i, 1, *it); - uint len = (*it).length(); - if(1 < len) { - i += len - 1; - sSize += len - 1; - } - } + for(QMap::const_iterator it = m_replaceMap.cbegin(); it != m_replaceMap.cend(); ++it) { + result.replace(it.key(), it.value()); } return result;