#include "lyxfind.h"
#include "Buffer.h"
-#include "buffer_funcs.h"
#include "BufferList.h"
#include "BufferParams.h"
#include "BufferView.h"
#include "output_latex.h"
#include "OutputParams.h"
#include "Paragraph.h"
-#include "ParIterator.h"
-#include "TexRow.h"
#include "Text.h"
#include "Encoding.h"
#include "frontends/alert.h"
#include "mathed/InsetMath.h"
-#include "mathed/InsetMathGrid.h"
#include "mathed/InsetMathHull.h"
#include "mathed/MathData.h"
#include "mathed/MathStream.h"
#include "mathed/MathSupport.h"
-#include "support/convert.h"
#include "support/debug.h"
#include "support/docstream.h"
#include "support/FileName.h"
ignoreSectioning_(false), ignoreFrontMatter_(false),
ignoreColor_(false), ignoreLanguage_(false) {}
///
- bool getFamily() { return ignoreFamily_; };
+ bool getFamily() { return ignoreFamily_; }
///
- bool getSeries() { return ignoreSeries_; };
+ bool getSeries() { return ignoreSeries_; }
///
- bool getShape() { return ignoreShape_; };
+ bool getShape() { return ignoreShape_; }
///
- bool getUnderline() { return ignoreUnderline_; };
+ bool getUnderline() { return ignoreUnderline_; }
///
- bool getMarkUp() { return ignoreMarkUp_; };
+ bool getMarkUp() { return ignoreMarkUp_; }
///
- bool getStrikeOut() { return ignoreStrikeOut_; };
+ bool getStrikeOut() { return ignoreStrikeOut_; }
///
- bool getSectioning() { return ignoreSectioning_; };
+ bool getSectioning() { return ignoreSectioning_; }
///
- bool getFrontMatter() { return ignoreFrontMatter_; };
+ bool getFrontMatter() { return ignoreFrontMatter_; }
///
- bool getColor() { return ignoreColor_; };
+ bool getColor() { return ignoreColor_; }
///
- bool getLanguage() { return ignoreLanguage_; };
+ bool getLanguage() { return ignoreLanguage_; }
///
- void setIgnoreFormat(string type, bool value);
+ void setIgnoreFormat(string const & type, bool value);
private:
///
};
-void IgnoreFormats::setIgnoreFormat(string type, bool value)
+void IgnoreFormats::setIgnoreFormat(string const & type, bool value)
{
if (type == "color") {
ignoreColor_ = value;
IgnoreFormats ignoreFormats;
-void setIgnoreFormat(string type, bool value)
+void setIgnoreFormat(string const & type, bool value)
{
ignoreFormats.setIgnoreFormat(type, value);
}
}
-class MatchString : public binary_function<Paragraph, pos_type, int>
+class MatchString
{
public:
- MatchString(docstring const & str, bool cs, bool mw)
- : str(str), case_sens(cs), whole_words(mw)
+ MatchString(docstring const & s, bool cs, bool mw)
+ : str(s), case_sens(cs), whole_words(mw)
{}
// returns true if the specified string is at the specified position
bool whole, bool forward, bool findnext)
{
Cursor & cur = bv->cursor();
- bool found = false;
if (!cur.selection()) {
// no selection, non-empty search string: find it
if (!searchstr.empty()) {
- found = findOne(bv, searchstr, case_sens, whole, forward, true, findnext);
+ bool const found = findOne(bv, searchstr, case_sens, whole, forward, true, findnext);
return make_pair(found, 0);
}
// empty search string
// no selection or current selection is not search word:
// just find the search word
if (!have_selection || !match) {
- found = findOne(bv, searchstr, case_sens, whole, forward, true, findnext);
+ bool const found = findOne(bv, searchstr, case_sens, whole, forward, true, findnext);
return make_pair(found, 0);
}
// + allow to search for colored text too
while (regex_replace(t, t, REGEX_BOS "\\\\(((footnotesize|tiny|scriptsize|small|large|Large|LARGE|huge|Huge|emph|noun|minisec|text(bf|md|sl|sf|it|tt))|((textcolor|foreignlanguage|latexenvironment)\\{[a-z]+\\*?\\})|(u|uu)line|(s|x)out|uwave)|((sub)?(((sub)?section)|paragraph)|part|chapter)\\*?)\\{", "")
|| regex_replace(t, t, REGEX_BOS "\\$", "")
- || regex_replace(t, t, REGEX_BOS "\\\\\\[ ", "")
+ || regex_replace(t, t, REGEX_BOS "\\\\\\[", "")
|| regex_replace(t, t, REGEX_BOS " ?\\\\item\\{[a-z]+\\}", "")
- || regex_replace(t, t, REGEX_BOS "\\\\begin\\{[a-zA-Z_]*\\*?\\} ", ""))
+ || regex_replace(t, t, REGEX_BOS "\\\\begin\\{[a-zA-Z_]*\\*?\\}", ""))
;
LYXERR(Debug::FIND, " after removing leading $, \\[ , \\emph{, \\textbf{, etc.: '" << t << "'");
return s.find(t);
bool isPatternString_;
public:
explicit Intervall(bool isPattern, string const & p) :
- isPatternString_(isPattern), par(p), ignoreidx(-1), actualdeptindex(0),
- hasTitle(false)
+ isPatternString_(isPattern), par(p), ignoreidx(-1), actualdeptindex(0),
+ hasTitle(false), langcount(0)
{
depts[0] = 0;
closes[0] = 0;
void addIntervall(int upper);
void addIntervall(int low, int upper); /* if explicit */
void removeAccents();
- void setForDefaultLang(KeyInfo &defLang);
+ void setForDefaultLang(KeyInfo const & defLang);
int findclosing(int start, int end, char up, char down, int repeat);
void handleParentheses(int lastpos, bool closingAllowed);
bool hasTitle;
+ int langcount; // Number of disabled language specs up to current position in actual interval
int isOpeningPar(int pos);
string titleValue;
void output(ostringstream &os, int lastpos);
return 1;
}
-void Intervall::setForDefaultLang(KeyInfo &defLang)
+void Intervall::setForDefaultLang(KeyInfo const & defLang)
{
// Enable the use of first token again
if (ignoreidx >= 0) {
static int maxdepthidx = MAXOPENED-2;
static int lastmaxdepth = 0;
if (val > lastmaxdepth) {
- LYXERR0("Depth reached " << val);
+ LYXERR(Debug::INFO, "Depth reached " << val);
lastmaxdepth = val;
}
if (val > maxdepthidx) {
maxdepthidx = val;
- LYXERR0("maxdepthidx now " << val);
+ LYXERR(Debug::INFO, "maxdepthidx now " << val);
}
}
{
static int lastmaxignore = -1;
if ((lastmaxignore < val) && (size_t(val+1) >= borders.size())) {
- LYXERR0("IgnoreIdx reached " << val);
+ LYXERR(Debug::INFO, "IgnoreIdx reached " << val);
lastmaxignore = val;
}
}
const char delim = '|';
while (getline(s, name, delim)) {
size_t start = 0;
- for (size_t i = 0; i < param.size(); i++) {
- string key = name + "{" + param[i] + "}";
+ for (char c : param) {
+ string key = name + "{" + c + "}";
// get the corresponding utf8-value
if ((values[start] & 0xc0) != 0xc0) {
// should not happen, utf8 encoding starts at least with 11xxxxxx
if ((values[start] & 0x80) == 0) {
// is ascii
accents[key] = values.substr(start, 1);
- // LYXERR0("" << key << "=" << accents[key]);
+ // LYXERR(Debug::INFO, "" << key << "=" << accents[key]);
}
start++;
continue;
// This is the first byte of following utf8 char
accents[key] = values.substr(start, j);
start += j;
- // LYXERR0("" << key << "=" << accents[key]);
+ // LYXERR(Debug::INFO, "" << key << "=" << accents[key]);
break;
}
}
accents["lyxmathsym{ß}"] = "ß";
accents["text{ß}"] = "ß";
accents["ddot{\\imath}"] = "ï";
- buildaccent("ddot", "aAeEiIioOuUyY",
- "äÄëËïÏïöÖüÜÿŸ"); // umlaut
- buildaccent("dot|.", "cCeEGgIizZaAoObBdDfFyY",
- "ċĊėĖĠġİİżŻȧȦȯȮḃḂḋḊḟḞẏẎ"); // dot{i} can only happen if ignoring case, but there is no lowercase of 'İ'
+ buildaccent("ddot", "aAeEhHiIioOtuUwWxXyY",
+ "äÄëËḧḦïÏïöÖẗüÜẅẄẍẌÿŸ"); // umlaut
+ buildaccent("dot|.", "aAbBcCdDeEfFGghHIimMnNoOpPrRsStTwWxXyYzZ",
+ "ȧȦḃḂċĊḋḊėĖḟḞĠġḣḢİİṁṀṅṄȯȮṗṖṙṘṡṠṫṪẇẆẋẊẏẎżŻ"); // dot{i} can only happen if ignoring case, but there is no lowercase of 'İ'
accents["acute{\\imath}"] = "í";
- buildaccent("acute", "aAcCeElLoOnNrRsSuUyYzZiI",
- "áÁćĆéÉĺĹóÓńŃŕŔśŚúÚýÝźŹíÍ");
+ buildaccent("acute", "aAcCeEgGkKlLmMoOnNpPrRsSuUwWyYzZiI",
+ "áÁćĆéÉǵǴḱḰĺĹḿḾóÓńŃṕṔŕŔśŚúÚẃẂýÝźŹíÍ");
buildaccent("dacute|H|h", "oOuU", "őŐűŰ"); // double acute
buildaccent("mathring|r", "aAuUwy",
"åÅůŮẘẙ"); // ring
"čČďĎǎǍěĚǐǏǒǑǔǓǧǦǩǨȟȞľĽňŇřŘšŠŤťžŽ"); // caron
accents["hat{\\imath}"] = "î";
accents["hat{\\jmath}"] = "ĵ";
- buildaccent("hat|^", "aAeEiIcCgGhHjJsSwWyYzZoOuU",
- "âÂêÊîÎĉĈĝĜĥĤĵĴŝŜŵŴŷŶẑẐôÔûÛ"); // circ
+ buildaccent("hat|^", "aAcCeEgGhHiIjJoOsSuUwWyYzZ",
+ "âÂĉĈêÊĝĜĥĤîÎĵĴôÔŝŜûÛŵŴŷŶẑẐ"); // circ
accents["bar{\\imath}"] = "ī";
buildaccent("bar|=", "aAeEiIoOuUyY",
"āĀēĒīĪōŌūŪȳȲ"); // macron
accents["tilde{\\imath}"] = "ĩ";
- buildaccent("tilde", "aAnNoOiIuU",
- "ãÃñÑõÕĩĨũŨ"); // tilde
+ buildaccent("tilde", "aAeEiInNoOuUvVyY",
+ "ãÃẽẼĩĨñÑõÕũŨṽṼỹỸ"); // tilde
accents["breve{\\imath}"] = "ĭ";
buildaccent("breve|u", "aAeEgGiIoOuU",
"ăĂĕĔğĞĭĬŏŎŭŬ"); // breve
accents["textroundcap{\\i}"] = "ȉ";
buildaccent("rcap|textroundcap", "AaEeIiOoRrUu",
"ȂȃȆȇȊȋȎȏȒȓȖȗ"); // inverted breve
+ buildaccent("slashed", "oO",
+ "øØ"); // slashed
}
/*
{
if (accents.empty())
buildAccentsMap();
- static regex const accre("\\\\(([\\S]|grave|breve|lyxmathsym|text|ddot|dot|acute|dacute|mathring|check|hat|bar|tilde|subdot|ogonek|cedilla|subring|textsubring|subhat|textsubcircum|subtilde|textsubtilde|dgrave|textdoublegrave|rcap|textroundcap)\\{[^\\{\\}]+\\}|(i|imath|jmath)(?![a-zA-Z]))");
+ static regex const accre("\\\\(([\\S]|grave|breve|lyxmathsym|text|ddot|dot|acute|dacute|mathring|check|hat|bar|tilde|subdot|ogonek|cedilla|subring|textsubring|subhat|textsubcircum|subtilde|textsubtilde|dgrave|textdoublegrave|rcap|textroundcap|slashed)\\{[^\\{\\}]+\\}|(i|imath|jmath)(?![a-zA-Z]))");
smatch sub;
for (sregex_iterator itacc(par.begin(), par.end(), accre), end; itacc != end; ++itacc) {
sub = *itacc;
}
}
else {
- LYXERR0("Not added accent for \"" << key << "\"");
+ LYXERR(Debug::INFO, "Not added accent for \"" << key << "\"");
}
}
}
void buildEntries(bool);
void makeKey(const string &, KeyInfo, bool isPatternString);
void processRegion(int start, int region_end); /* remove {} parts */
- void removeHead(KeyInfo&, int count=0);
+ void removeHead(KeyInfo const &, int count=0);
public:
- LatexInfo(string par, bool isPatternString) : entidx_(-1), interval_(isPatternString, par)
+ LatexInfo(string const & par, bool isPatternString)
+ : entidx_(-1), interval_(isPatternString, par)
{
buildKeys(isPatternString);
entries_ = vector<KeyInfo>();
}
return -1;
};
- int process(ostringstream &os, KeyInfo &actual);
- int dispatch(ostringstream &os, int previousStart, KeyInfo &actual);
+ int process(ostringstream & os, KeyInfo const & actual);
+ int dispatch(ostringstream & os, int previousStart, KeyInfo & actual);
// string show(int lastpos) { return interval.show(lastpos);};
int nextNotIgnored(int start) { return interval_.nextNotIgnored(start);};
KeyInfo &getKeyInfo(int keyinfo) {
{
int skip = 0;
int depth = 0;
- repeat--;
for (int i = start; i < end; i += 1 + skip) {
char c;
c = par[i];
}
else if (c == down) {
if (depth == 0) {
+ repeat--;
if ((repeat <= 0) || (par[i+1] != up))
return i;
}
MathInfo() {
actualIdx_ = 0;
}
- void insert(string wait, size_t start, size_t end) {
+ void insert(string const & wait, size_t start, size_t end) {
MathEntry m = MathEntry();
m.wait = wait;
m.mathStart = start;
}
found._tokensize = found.head.length();
found._dataStart = found._tokenstart + found.head.length();
+ if (found.keytype == KeyInfo::doRemove) {
+ int endpar = 2 + interval_.findclosing(found._dataStart, interval_.par.length(), '{', '}', closings);
+ found._dataStart = endpar;
+ found._tokensize = found._dataStart - found._tokenstart;
+ closings = 0;
+ }
if (interval_.par.substr(found._dataStart-1, 15).compare("\\endarguments{}") == 0) {
found._dataStart += 15;
}
- size_t endpos = interval_.findclosing(found._dataStart, interval_.par.length(), '{', '}', closings);
+ size_t endpos;
+ if (closings < 1)
+ endpos = found._dataStart - 1;
+ else
+ endpos = interval_.findclosing(found._dataStart, interval_.par.length(), '{', '}', closings);
if (found.keytype == KeyInfo::isList) {
// Check if it really is list env
static regex const listre("^([a-z]+)$");
// handle like standard keys with 1 parameter.
makeKey("url|href|vref|thanks", KeyInfo(KeyInfo::isStandard, 1, false), isPatternString);
+ // Ignore deleted text
+ makeKey("lyxdeleted", KeyInfo(KeyInfo::doRemove, 3, false), isPatternString);
+ // but preserve added text
+ makeKey("lyxadded", KeyInfo(KeyInfo::doRemove, 2, false), isPatternString);
+
// Macros to remove, but let the parameter survive
// No split
makeKey("menuitem|textmd|textrm", KeyInfo(KeyInfo::isStandard, 1, true), isPatternString);
printed += lastpos-i;
}
handleParentheses(lastpos, false);
- for (int i = actualdeptindex; i > 0; --i) {
+ int startindex;
+ if (keys["foreignlanguage"].disabled)
+ startindex = actualdeptindex-langcount;
+ else
+ startindex = actualdeptindex;
+ for (int i = startindex; i > 0; --i) {
os << "}";
}
if (hasTitle && (printed > 0))
}
}
-void LatexInfo::removeHead(KeyInfo &actual, int count)
+void LatexInfo::removeHead(KeyInfo const & actual, int count)
{
if (actual.parenthesiscount == 0) {
// "{\tiny{} ...}" ==> "{{} ...}"
if ((interval_.par[pos] != ' ') && (interval_.par[pos] != '%'))
break;
}
- interval_.addIntervall(actual._tokenstart, pos);
+ // Remove also enclosing parentheses [] and {}
+ int numpars = 0;
+ int spaces = 0;
+ while (actual._tokenstart > numpars) {
+ if (pos+numpars >= interval_.par.size())
+ break;
+ else if (interval_.par[pos+numpars] == ']' && interval_.par[actual._tokenstart-numpars-1] == '[')
+ numpars++;
+ else if (interval_.par[pos+numpars] == '}' && interval_.par[actual._tokenstart-numpars-1] == '{')
+ numpars++;
+ else
+ break;
+ }
+ if (numpars > 0) {
+ if (interval_.par[pos+numpars] == ' ')
+ spaces++;
+ }
+
+ interval_.addIntervall(actual._tokenstart-numpars, pos+numpars+spaces);
nextKeyIdx = getNextKey();
break;
}
int val = actual._tokenstart;
for (count = 0; count < actual._tokenstart;) {
val = interval_.previousNotIgnored(val-1);
- if (interval_.par[val] != ' ')
+ if (val < 0 || interval_.par[val] != ' ')
break;
else {
count = actual._tokenstart - val;
}
if (actual.disabled) {
removeHead(actual);
+ interval_.langcount++;
if ((interval_.par.substr(actual._dataStart, 3) == " \\[") ||
(interval_.par.substr(actual._dataStart, 8) == " \\begin{")) {
// Discard also the space before math-equation
// This cannot happen, already handled
// fall through
default: {
- // LYXERR0("Unhandled keytype");
+ // LYXERR(Debug::INFO, "Unhandled keytype");
nextKeyIdx = getNextKey();
break;
}
return nextKeyIdx;
}
-int LatexInfo::process(ostringstream &os, KeyInfo &actual )
+int LatexInfo::process(ostringstream & os, KeyInfo const & actual )
{
int end = interval_.nextNotIgnored(actual._dataEnd);
int oldStart = actual._dataStart;
if (oldStart <= end) {
processRegion(oldStart, end);
}
- if (interval_.par[end] == '}') {
+ if (interval_.par.size() > (size_t) end && interval_.par[end] == '}') {
end += 1;
// This is the normal case.
// But if using the firstlanguage, the closing may be missing
{
ostringstream os;
LatexInfo li(par, isPatternString);
- // LYXERR0("Berfore split: " << par);
+ // LYXERR(Debug::INFO, "Berfore split: " << par);
KeyInfo DummyKey = KeyInfo(KeyInfo::KeyType::isMain, 2, true);
DummyKey.head = "";
DummyKey._tokensize = 0;
}
else
s = par; /* no known macros found */
- // LYXERR0("After split: " << s);
+ // LYXERR(Debug::INFO, "After split: " << s);
return s;
}
string a = it->first;
regex_with_format = true;
features += " " + a;
- // LYXERR0("Identified regex format:" << a);
+ // LYXERR(Debug::INFO, "Identified regex format:" << a);
}
LYXERR(Debug::FIND, "Identified Features" << features);
}
}
else {
- // LYXERR0("No regex formats");
+ // LYXERR(Debug::INFO, "No regex formats");
}
return result;
}
LYXERR(Debug::FIND, "identifyClosing(): t now is '" << t << "'");
if (regex_replace(t, t, "(.*[^\\\\])\\$" REGEX_EOS, "$1"))
continue;
- if (regex_replace(t, t, "(.*[^\\\\]) \\\\\\]" REGEX_EOS, "$1"))
+ if (regex_replace(t, t, "(.*[^\\\\])\\\\\\]" REGEX_EOS, "$1"))
continue;
- if (regex_replace(t, t, "(.*[^\\\\]) \\\\end\\{[a-zA-Z_]*\\*?\\}" REGEX_EOS, "$1"))
+ if (regex_replace(t, t, "(.*[^\\\\])\\\\end\\{[a-zA-Z_]*\\*?\\}" REGEX_EOS, "$1"))
continue;
if (regex_replace(t, t, "(.*[^\\\\])\\}" REGEX_EOS, "$1")) {
++open_braces;
lng -= 2;
open_braces++;
}
- else
+ else
break;
- }
+}
if (lng < par_as_string.size())
par_as_string = par_as_string.substr(0,lng);
/*
if (m.size() > 1)
leadingsize = m[1].second - m[1].first;
int result;
- for (size_t i = 0; i < m.size(); i++) {
- LYXERR(Debug::FIND, "Match " << i << " is " << m[i].second - m[i].first << " long");
- }
+ for (size_t i = 0; i < m.size(); i++) {
+ LYXERR(Debug::FIND, "Match " << i << " is " << m[i].second - m[i].first << " long");
+ }
if (close_wildcards == 0)
result = m[0].second - m[0].first;
<< ", inTexted=" << cur.inTexted());
if (res == 0 || !at_begin || !opt.matchword || !cur.inTexted())
return mres;
- if ((len > 0) && (res < len)) {
+ if ((len > 0) && (res < len)) {
mres.match_len = 0;
- return mres;
+ return mres;
}
Paragraph const & par = cur.paragraph();
bool ws_left = (cur.pos() > 0)
? par.isWordSeparator(cur.pos() - 1)
: true;
- bool ws_right = (cur.pos() + len < par.size())
+ bool ws_right;
+ if (len < 0)
+ ws_right = true;
+ else {
+ ws_right = (cur.pos() + len < par.size())
? par.isWordSeparator(cur.pos() + len)
: true;
+ }
LYXERR(Debug::FIND,
"cur.pos()=" << cur.pos() << ", res=" << res
<< ", separ: " << ws_left << ", " << ws_right
- << ", len: " << len
+ << ", len: " << len
<< endl);
if (ws_left && ws_right) {
- // Check for word separators inside the found 'word'
- for (int i = 0; i < len; i++) {
- if (par.isWordSeparator(cur.pos() + i)) {
+ // Check for word separators inside the found 'word'
+ for (int i = 0; i < len; i++) {
+ if (par.isWordSeparator(cur.pos() + i)) {
mres.match_len = 0;
- return mres;
+ return mres;
}
- }
- return mres;
- }
+ }
+ return mres;
+ }
mres.match_len = 0;
return mres;
}
} while (cur.depth() > old_cur.depth()); /* Skip inner insets */
if (cur.depth() < old_cur.depth()) {
// Outer inset?
- LYXERR0("cur.depth() < old_cur.depth(), this should never happen");
+ LYXERR(Debug::INFO, "cur.depth() < old_cur.depth(), this should never happen");
break;
}
if (cur.pos() != old_cur.pos()) {
}
}
else {
- LYXERR0("cur.pos() == old_cur.pos(), this should never happen");
+ LYXERR(Debug::INFO, "cur.pos() == old_cur.pos(), this should never happen");
actual_match = match(cur, len).match_len;
if (actual_match == max_match)
old_cur = cur;
/// Finds forward
-int findForwardAdv(DocIterator & cur, MatchStringAdv & match)
+int findForwardAdv(DocIterator & cur, MatchStringAdv const & match)
{
if (!cur)
return 0;
int match_len = mres.match_len;
LYXERR(Debug::FIND, "match_len: " << match_len);
if ((mres.pos > 100000) || (mres.match2end > 100000) || (match_len > 100000)) {
- LYXERR0("BIG LENGTHS: " << mres.pos << ", " << match_len << ", " << mres.match2end);
+ LYXERR(Debug::INFO, "BIG LENGTHS: " << mres.pos << ", " << match_len << ", " << mres.match2end);
match_len = 0;
}
if (match_len > 0) {
match_len_zero_count = 0;
}
else {
- if (++match_len_zero_count > 3) {
- LYXERR(Debug::FIND, "match_len2_zero_count: " << match_len_zero_count << ", match_len was " << match_len);
- match_len_zero_count = 0;
- }
+ if (++match_len_zero_count > 3) {
+ LYXERR(Debug::FIND, "match_len2_zero_count: " << match_len_zero_count << ", match_len was " << match_len);
+ }
break;
}
}
FindAndReplaceOptions::FindAndReplaceOptions(
- docstring const & find_buf_name, bool casesensitive,
- bool matchword, bool forward, bool expandmacros, bool ignoreformat,
- docstring const & repl_buf_name, bool keep_case,
- SearchScope scope, SearchRestriction restr, bool replace_all)
- : find_buf_name(find_buf_name), casesensitive(casesensitive), matchword(matchword),
- forward(forward), expandmacros(expandmacros), ignoreformat(ignoreformat),
- repl_buf_name(repl_buf_name), keep_case(keep_case), scope(scope), restr(restr), replace_all(replace_all)
+ docstring const & _find_buf_name, bool _casesensitive,
+ bool _matchword, bool _forward, bool _expandmacros, bool _ignoreformat,
+ docstring const & _repl_buf_name, bool _keep_case,
+ SearchScope _scope, SearchRestriction _restr, bool _replace_all)
+ : find_buf_name(_find_buf_name), casesensitive(_casesensitive), matchword(_matchword),
+ forward(_forward), expandmacros(_expandmacros), ignoreformat(_ignoreformat),
+ repl_buf_name(_repl_buf_name), keep_case(_keep_case), scope(_scope), restr(_restr), replace_all(_replace_all)
{
}
static void changeFirstCase(Buffer & buffer, TextCase first_case, TextCase others_case)
{
ParagraphList::iterator pit = buffer.paragraphs().begin();
- LASSERT(pit->size() >= 1, /**/);
+ LASSERT(!pit->empty(), /**/);
pos_type right = pos_type(1);
pit->changeCase(buffer.params(), pos_type(0), right, first_case);
right = pit->size();
static int findAdvReplace(BufferView * bv, FindAndReplaceOptions const & opt, MatchStringAdv & matchAdv)
{
Cursor & cur = bv->cursor();
- if (opt.repl_buf_name == docstring()
+ if (opt.repl_buf_name.empty()
|| theBufferList().getBuffer(FileName(to_utf8(opt.repl_buf_name)), true) == 0
|| theBufferList().getBuffer(FileName(to_utf8(opt.find_buf_name)), true) == 0)
return 0;
return 0;
// Build a copy of the replace buffer, adapted to the KeepCase option
- Buffer & repl_buffer_orig = *theBufferList().getBuffer(FileName(to_utf8(opt.repl_buf_name)), true);
+ Buffer const & repl_buffer_orig = *theBufferList().getBuffer(FileName(to_utf8(opt.repl_buf_name)), true);
ostringstream oss;
repl_buffer_orig.write(oss);
string lyx = oss.str();