]> git.lyx.org Git - lyx.git/blobdiff - src/Lexer.cpp
Fix assertion when checking if change in selection
[lyx.git] / src / Lexer.cpp
index bbae12418c0bd1da6abfd542a6cdbc63b2e1976b..098faa9737282c3fc40458ec67665b26b8b881ef 100644 (file)
@@ -148,7 +148,7 @@ public:
        }
 };
 
-} // end of anon namespace
+} // namespace
 
 
 Lexer::Pimpl::Pimpl(LexerKeyword * tab, int num)
@@ -738,7 +738,7 @@ docstring Lexer::getLongString(docstring const & endtoken)
                        break;
 
                if (firstline) {
-                       size_t i = tmpstr.find_first_not_of(char_type(' '));
+                       size_t i = tmpstr.find_first_not_of(from_ascii(" \t"));
                        if (i != string::npos)
                                prefix = tmpstr.substr(0, i);
                        firstline = false;
@@ -747,10 +747,10 @@ docstring Lexer::getLongString(docstring const & endtoken)
 
                // further lines in long strings may have the same
                // whitespace prefix as the first line. Remove it.
-               if (prefix.length() && prefixIs(tmpstr, prefix))
-                       tmpstr.erase(0, prefix.length() - 1);
+               if (!prefix.empty() && prefixIs(tmpstr, prefix))
+                       tmpstr.erase(0, prefix.length());
 
-               str += ltrim(tmpstr, "\t") + '\n';
+               str += tmpstr + '\n';
        }
 
        if (!pimpl_->is)
@@ -762,7 +762,7 @@ docstring Lexer::getLongString(docstring const & endtoken)
 
 bool Lexer::getBool() const
 {
-       string const s = pimpl_->getString();   
+       string const s = pimpl_->getString();
        if (s == "false" || s == "0") {
                lastReadOk_ = true;
                return false;
@@ -917,7 +917,7 @@ docstring Lexer::quoteString(docstring const & arg)
 {
        docstring res;
        res += '"';
-       res += subst(subst(arg, from_ascii("\\"), from_ascii("\\\\")), 
+       res += subst(subst(arg, from_ascii("\\"), from_ascii("\\\\")),
                     from_ascii("\""), from_ascii("\\\""));
        res += '"';
        return res;
@@ -929,7 +929,7 @@ Lexer & Lexer::operator>>(char const * required)
        string token;
        *this >> token;
        if (token != required) {
-               LYXERR0("Missing '" << required << "'-tag in " << pimpl_->context 
+               LYXERR0("Missing '" << required << "'-tag in " << pimpl_->context
                        << ". Got " << token << " instead. Line: " << lineNumber());
                pushToken(token);
        }