small cleanup

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4841 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2002-08-02 13:43:43 +00:00
parent 2830796638
commit 3f1a78fbeb
2 changed files with 24 additions and 21 deletions

View File

@ -4,6 +4,10 @@
* lyxfunc.C (moveCursorUpdate, dispatch, view_status_message): * lyxfunc.C (moveCursorUpdate, dispatch, view_status_message):
changes due to LyXView::view() now returning a boost::shared_ptr. changes due to LyXView::view() now returning a boost::shared_ptr.
2002-08-02 John Levon <levon@movementarian.org>
* lyxlex.C: small cleanup
2002-08-02 John Levon <levon@movementarian.org> 2002-08-02 John Levon <levon@movementarian.org>
* text2.C (status): small cleanup, no logic change * text2.C (status): small cleanup, no logic change

View File

@ -168,29 +168,28 @@ string const LyXLex::getLongString(string const & endtoken)
// We do a case independent comparison, like search_kw // We do a case independent comparison, like search_kw
// does. // does.
if (compare_ascii_no_case(token, endtoken) != 0) { if (compare_ascii_no_case(token, endtoken) == 0)
break;
string tmpstr = getString(); string tmpstr = getString();
if (firstline) { if (firstline) {
unsigned int i = 0; string::size_type i(tmpstr.find_first_not_of(' '));
while (i < tmpstr.length() if (i != string::npos)
&& tmpstr[i] == ' ') { prefix = tmpstr.substr(0, i);
++i;
prefix += ' ';
}
firstline = false; firstline = false;
lyxerr[Debug::PARSER] << "Prefix = `" << prefix lyxerr[Debug::PARSER]
<< '\'' << endl; << "Prefix = `" << prefix << "\'" << endl;
} }
if (!prefix.empty() // further lines in long strings may have the same
&& prefixIs(tmpstr, prefix)) { // whitespace prefix as the first line. Remove it.
if (prefixIs(tmpstr, prefix)) {
tmpstr.erase(0, prefix.length() - 1); tmpstr.erase(0, prefix.length() - 1);
} }
str += ltrim(tmpstr, "\t") + '\n'; str += ltrim(tmpstr, "\t") + '\n';
} }
else // token == endtoken
break;
}
if (!isOK()) { if (!isOK()) {
printError("Long string not ended by `" + endtoken + '\''); printError("Long string not ended by `" + endtoken + '\'');
} }