mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
FindAdv: Use private variable for_search
Using the new inline statements find_effective(), find_with_non_output(), find_with_deleted(), find_set_feature(), find_add_feature() and find_clean_features() makes the code a slightly better readable.
This commit is contained in:
parent
e6f5f428d7
commit
62ab563c25
@ -336,7 +336,7 @@ int Font::latexWriteStartChanges(otexstream & os, BufferParams const & bparams,
|
||||
p.reduce(prev.bits_);
|
||||
|
||||
if (f.size() != INHERIT_SIZE) {
|
||||
if (runparams.for_search == OutputParams::NoSearch) {
|
||||
if (!runparams.find_effective()) {
|
||||
os << '{';
|
||||
++count;
|
||||
os << '\\'
|
||||
|
@ -433,7 +433,12 @@ public:
|
||||
SearchNonOutput = 8
|
||||
};
|
||||
|
||||
int for_search = NoSearch;
|
||||
inline bool find_effective(void) const { return (for_search != OutputParams::NoSearch); }
|
||||
inline bool find_with_non_output() const { return ((for_search & OutputParams::SearchNonOutput) != 0); }
|
||||
inline bool find_with_deleted() const { return ((for_search & OutputParams::SearchWithDeleted) != 0); }
|
||||
inline void find_set_feature(enum Search set_) { for_search = set_; }
|
||||
inline void find_add_feature(enum Search add_) { for_search |= add_; }
|
||||
inline void find_clean_features(void) { for_search = OutputParams::NoSearch; }
|
||||
|
||||
/// Are we generating this material for instant preview?
|
||||
bool for_preview = false;
|
||||
@ -446,6 +451,8 @@ public:
|
||||
|
||||
/// A postponed \\noindent (after VSpace)
|
||||
mutable bool need_noindent = false;
|
||||
private:
|
||||
int for_search = NoSearch;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1209,10 +1209,10 @@ void Paragraph::Private::latexSpecialChar(otexstream & os,
|
||||
{
|
||||
char_type const c = owner_->getUChar(bparams, runparams, i);
|
||||
|
||||
if (style.pass_thru || runparams.pass_thru || (runparams.for_search != OutputParams::NoSearch)
|
||||
if (style.pass_thru || runparams.pass_thru || runparams.find_effective()
|
||||
|| contains(style.pass_thru_chars, c)
|
||||
|| contains(runparams.pass_thru_chars, c)) {
|
||||
if (runparams.for_search != OutputParams::NoSearch) {
|
||||
if (runparams.find_effective()) {
|
||||
switch (c) {
|
||||
case '\\':
|
||||
os << "\\\\";
|
||||
@ -2622,7 +2622,7 @@ void Paragraph::latex(BufferParams const & bparams,
|
||||
runparams);
|
||||
runningChange = Change(Change::UNCHANGED);
|
||||
|
||||
os << ((isEnvSeparator(i) && (runparams.for_search == OutputParams::NoSearch)) ? "}]~" : "}] ");
|
||||
os << ((isEnvSeparator(i) && !runparams.find_effective()) ? "}]~" : "}] ");
|
||||
column +=3;
|
||||
}
|
||||
// For InTitle commands, we have already opened a group
|
||||
@ -2652,10 +2652,10 @@ void Paragraph::latex(BufferParams const & bparams,
|
||||
|
||||
// Check whether a display math inset follows
|
||||
bool output_changes;
|
||||
if (runparams.for_search == OutputParams::NoSearch)
|
||||
if (!runparams.find_effective())
|
||||
output_changes = bparams.output_changes;
|
||||
else
|
||||
output_changes = ((runparams.for_search & OutputParams::SearchWithDeleted) != 0);
|
||||
output_changes = runparams.find_with_deleted();
|
||||
if (c == META_INSET
|
||||
&& i >= start_pos && (end_pos == -1 || i < end_pos)) {
|
||||
if (isDeleted(i))
|
||||
@ -4598,7 +4598,7 @@ int Paragraph::find(docstring const & str, bool cs, bool mw,
|
||||
odocstringstream os;
|
||||
if (inset->lyxCode() == lyx::QUOTE_CODE) {
|
||||
OutputParams op(0);
|
||||
op.for_search = OutputParams::SearchQuick;
|
||||
op.find_set_feature(OutputParams::SearchQuick);
|
||||
inset->plaintext(os, op);
|
||||
}
|
||||
else {
|
||||
|
@ -983,7 +983,7 @@ int InsetBibtex::plaintext(odocstringstream & os,
|
||||
// We could output more information here, e.g., what databases are included
|
||||
// and information about options. But I don't necessarily see any reason to
|
||||
// do this right now.
|
||||
if (op.for_tooltip || op.for_toc || op.for_search != OutputParams::NoSearch) {
|
||||
if (op.for_tooltip || op.for_toc || op.find_effective()) {
|
||||
os << '[' << reflabel << ']' << '\n';
|
||||
return PLAINTEXT_NEWLINE;
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ bool InsetBranch::producesOutput() const
|
||||
|
||||
void InsetBranch::latex(otexstream & os, OutputParams const & runparams) const
|
||||
{
|
||||
if (producesOutput() || ((runparams.for_search & OutputParams::SearchNonOutput) != 0)) {
|
||||
if (producesOutput() || runparams.find_with_non_output()) {
|
||||
OutputParams rp = runparams;
|
||||
rp.inbranch = true;
|
||||
InsetText::latex(os, rp);
|
||||
@ -335,7 +335,7 @@ void InsetBranch::latex(otexstream & os, OutputParams const & runparams) const
|
||||
int InsetBranch::plaintext(odocstringstream & os,
|
||||
OutputParams const & runparams, size_t max_length) const
|
||||
{
|
||||
if (!producesOutput() && ((runparams.for_search & OutputParams::SearchNonOutput) == 0))
|
||||
if (!producesOutput() && !runparams.find_with_non_output())
|
||||
return 0;
|
||||
|
||||
int len = InsetText::plaintext(os, runparams, max_length);
|
||||
|
@ -1006,14 +1006,14 @@ int InsetInclude::plaintext(odocstringstream & os,
|
||||
{
|
||||
// just write the filename if we're making a tooltip or toc entry,
|
||||
// or are generating this for advanced search
|
||||
if (op.for_tooltip || op.for_toc || op.for_search != OutputParams::NoSearch) {
|
||||
if (op.for_tooltip || op.for_toc || op.find_effective()) {
|
||||
os << '[' << screenLabel() << '\n'
|
||||
<< ltrim(getParam("filename")) << "\n]";
|
||||
return PLAINTEXT_NEWLINE + 1; // one char on a separate line
|
||||
}
|
||||
|
||||
if (isVerbatim(params()) || isListings(params())) {
|
||||
if (op.for_search != OutputParams::NoSearch) {
|
||||
if (op.find_effective()) {
|
||||
os << '[' << screenLabel() << ']';
|
||||
}
|
||||
else {
|
||||
|
@ -85,7 +85,7 @@ void InsetIndex::latex(otexstream & ios, OutputParams const & runparams_in) cons
|
||||
odocstringstream ourlatex;
|
||||
otexstream ots(ourlatex);
|
||||
InsetText::latex(ots, runparams);
|
||||
if (runparams.for_search != OutputParams::NoSearch) {
|
||||
if (runparams.find_effective()) {
|
||||
// No need for special handling, if we are only searching for some patterns
|
||||
os << ourlatex.str() << "}";
|
||||
return;
|
||||
|
@ -207,12 +207,12 @@ bool InsetNote::isMacroScope() const
|
||||
void InsetNote::latex(otexstream & os, OutputParams const & runparams_in) const
|
||||
{
|
||||
if (params_.type != InsetNoteParams::Greyedout
|
||||
&& runparams_in.for_search != OutputParams::NoSearch
|
||||
&& (runparams_in.for_search & OutputParams::SearchNonOutput) == 0)
|
||||
&& runparams_in.find_effective()
|
||||
&& !runparams_in.find_with_non_output())
|
||||
return;
|
||||
|
||||
if (params_.type == InsetNoteParams::Note) {
|
||||
if ((runparams_in.for_search & OutputParams::SearchNonOutput) != 0) {
|
||||
if (runparams_in.find_with_non_output()) {
|
||||
OutputParams runparams(runparams_in);
|
||||
InsetCollapsible::latex(os, runparams);
|
||||
runparams_in.encoding = runparams.encoding;
|
||||
@ -251,11 +251,11 @@ void InsetNote::latex(otexstream & os, OutputParams const & runparams_in) const
|
||||
int InsetNote::plaintext(odocstringstream & os,
|
||||
OutputParams const & runparams_in, size_t max_length) const
|
||||
{
|
||||
if ((runparams_in.for_search & OutputParams::SearchNonOutput) == 0) {
|
||||
if (!runparams_in.find_with_non_output()) {
|
||||
if (params_.type == InsetNoteParams::Note)
|
||||
return 0;
|
||||
else if (params_.type == InsetNoteParams::Comment
|
||||
&& (runparams_in.for_search != OutputParams::NoSearch))
|
||||
&& runparams_in.find_effective())
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -265,10 +265,10 @@ int InsetNote::plaintext(odocstringstream & os,
|
||||
// Ignore files that are exported inside a comment
|
||||
runparams.exportdata.reset(new ExportData);
|
||||
}
|
||||
if ((runparams_in.for_search & OutputParams::SearchNonOutput) == 0)
|
||||
if (!runparams_in.find_with_non_output())
|
||||
os << '[' << buffer().B_("note") << ":\n";
|
||||
InsetText::plaintext(os, runparams, max_length);
|
||||
if ((runparams_in.for_search & OutputParams::SearchNonOutput) == 0)
|
||||
if (!runparams_in.find_with_non_output())
|
||||
os << "\n]";
|
||||
|
||||
return PLAINTEXT_NEWLINE + 1; // one char on a separate line
|
||||
|
@ -851,7 +851,7 @@ void InsetQuotes::latex(otexstream & os, OutputParams const & runparams) const
|
||||
docstring qstr;
|
||||
|
||||
// In pass-thru context, we output plain quotes
|
||||
if (runparams.pass_thru || runparams.for_search != OutputParams::NoSearch)
|
||||
if (runparams.pass_thru || runparams.find_effective())
|
||||
qstr = (level_ == QuoteLevel::Primary) ? from_ascii("\"") : from_ascii("'");
|
||||
else if (style == QuoteStyle::Plain && fontspec_) {
|
||||
// For XeTeX and LuaTeX,we need to disable mapping to get straight
|
||||
@ -944,7 +944,7 @@ void InsetQuotes::latex(otexstream & os, OutputParams const & runparams) const
|
||||
int InsetQuotes::plaintext(odocstringstream & os,
|
||||
OutputParams const & op, size_t) const
|
||||
{
|
||||
if (op.for_search == OutputParams::NoSearch) {
|
||||
if (!op.find_effective()) {
|
||||
docstring const str = displayString();
|
||||
os << str;
|
||||
return str.size();
|
||||
|
@ -579,7 +579,7 @@ void InsetSpace::latex(otexstream & os, OutputParams const & runparams) const
|
||||
{
|
||||
switch (params_.kind) {
|
||||
case InsetSpaceParams::NORMAL:
|
||||
if (runparams.for_search != OutputParams::NoSearch)
|
||||
if (runparams.find_effective())
|
||||
os << "~";
|
||||
else
|
||||
os << (runparams.free_spacing ? " " : "\\ ");
|
||||
@ -588,21 +588,21 @@ void InsetSpace::latex(otexstream & os, OutputParams const & runparams) const
|
||||
if (runparams.local_font &&
|
||||
runparams.local_font->language()->lang() == "polutonikogreek")
|
||||
// in babel's polutonikogreek, ~ is active
|
||||
os << (runparams.free_spacing && (runparams.for_search == OutputParams::NoSearch) ? " " : "\\nobreakspace{}");
|
||||
os << (runparams.free_spacing && !runparams.find_effective() ? " " : "\\nobreakspace{}");
|
||||
else
|
||||
os << (runparams.free_spacing && (runparams.for_search == OutputParams::NoSearch) ? ' ' : '~');
|
||||
os << (runparams.free_spacing && !runparams.find_effective() ? ' ' : '~');
|
||||
break;
|
||||
case InsetSpaceParams::VISIBLE:
|
||||
os << (runparams.free_spacing && (runparams.for_search == OutputParams::NoSearch) ? " " : "\\textvisiblespace{}");
|
||||
os << (runparams.free_spacing && !runparams.find_effective() ? " " : "\\textvisiblespace{}");
|
||||
break;
|
||||
case InsetSpaceParams::THIN:
|
||||
if (runparams.for_search != OutputParams::NoSearch)
|
||||
if (runparams.find_effective())
|
||||
os << "\\thinspace{}";
|
||||
else
|
||||
os << (runparams.free_spacing ? " " : "\\,");
|
||||
break;
|
||||
case InsetSpaceParams::MEDIUM:
|
||||
if (runparams.for_search != OutputParams::NoSearch)
|
||||
if (runparams.find_effective())
|
||||
os << "\\medspace{}";
|
||||
else if (params_.math)
|
||||
os << (runparams.free_spacing ? " " : "\\:");
|
||||
@ -610,7 +610,7 @@ void InsetSpace::latex(otexstream & os, OutputParams const & runparams) const
|
||||
os << (runparams.free_spacing ? " " : "\\medspace{}");
|
||||
break;
|
||||
case InsetSpaceParams::THICK:
|
||||
if (runparams.for_search != OutputParams::NoSearch)
|
||||
if (runparams.find_effective())
|
||||
os << "\\thickspace{}";
|
||||
else if (params_.math)
|
||||
os << (runparams.free_spacing ? " " : "\\;");
|
||||
@ -618,49 +618,49 @@ void InsetSpace::latex(otexstream & os, OutputParams const & runparams) const
|
||||
os << (runparams.free_spacing ? " " : "\\thickspace{}");
|
||||
break;
|
||||
case InsetSpaceParams::QUAD:
|
||||
os << (runparams.free_spacing && (runparams.for_search != OutputParams::NoSearch) ? " " : "\\quad{}");
|
||||
os << (runparams.free_spacing && runparams.find_effective() ? " " : "\\quad{}");
|
||||
break;
|
||||
case InsetSpaceParams::QQUAD:
|
||||
os << (runparams.free_spacing && (runparams.for_search != OutputParams::NoSearch) ? " " : "\\qquad{}");
|
||||
os << (runparams.free_spacing && runparams.find_effective() ? " " : "\\qquad{}");
|
||||
break;
|
||||
case InsetSpaceParams::ENSPACE:
|
||||
os << (runparams.free_spacing && (runparams.for_search != OutputParams::NoSearch) ? " " : "\\enspace{}");
|
||||
os << (runparams.free_spacing && runparams.find_effective() ? " " : "\\enspace{}");
|
||||
break;
|
||||
case InsetSpaceParams::ENSKIP:
|
||||
os << (runparams.free_spacing && (runparams.for_search != OutputParams::NoSearch) ? " " : "\\enskip{}");
|
||||
os << (runparams.free_spacing && runparams.find_effective() ? " " : "\\enskip{}");
|
||||
break;
|
||||
case InsetSpaceParams::NEGTHIN:
|
||||
os << (runparams.free_spacing && (runparams.for_search != OutputParams::NoSearch) ? " " : "\\negthinspace{}");
|
||||
os << (runparams.free_spacing && runparams.find_effective() ? " " : "\\negthinspace{}");
|
||||
break;
|
||||
case InsetSpaceParams::NEGMEDIUM:
|
||||
os << (runparams.free_spacing && (runparams.for_search != OutputParams::NoSearch) ? " " : "\\negmedspace{}");
|
||||
os << (runparams.free_spacing && runparams.find_effective() ? " " : "\\negmedspace{}");
|
||||
break;
|
||||
case InsetSpaceParams::NEGTHICK:
|
||||
os << (runparams.free_spacing && (runparams.for_search != OutputParams::NoSearch) ? " " : "\\negthickspace{}");
|
||||
os << (runparams.free_spacing && runparams.find_effective() ? " " : "\\negthickspace{}");
|
||||
break;
|
||||
case InsetSpaceParams::HFILL:
|
||||
os << (runparams.free_spacing && (runparams.for_search != OutputParams::NoSearch) ? " " : "\\hfill{}");
|
||||
os << (runparams.free_spacing && runparams.find_effective() ? " " : "\\hfill{}");
|
||||
break;
|
||||
case InsetSpaceParams::HFILL_PROTECTED:
|
||||
os << (runparams.free_spacing && (runparams.for_search != OutputParams::NoSearch) ? " " : "\\hspace*{\\fill}");
|
||||
os << (runparams.free_spacing && runparams.find_effective() ? " " : "\\hspace*{\\fill}");
|
||||
break;
|
||||
case InsetSpaceParams::DOTFILL:
|
||||
os << (runparams.free_spacing && (runparams.for_search != OutputParams::NoSearch) ? " " : "\\dotfill{}");
|
||||
os << (runparams.free_spacing && runparams.find_effective() ? " " : "\\dotfill{}");
|
||||
break;
|
||||
case InsetSpaceParams::HRULEFILL:
|
||||
os << (runparams.free_spacing && (runparams.for_search != OutputParams::NoSearch) ? " " : "\\hrulefill{}");
|
||||
os << (runparams.free_spacing && runparams.find_effective() ? " " : "\\hrulefill{}");
|
||||
break;
|
||||
case InsetSpaceParams::LEFTARROWFILL:
|
||||
os << (runparams.free_spacing && (runparams.for_search != OutputParams::NoSearch) ? " " : "\\leftarrowfill{}");
|
||||
os << (runparams.free_spacing && runparams.find_effective() ? " " : "\\leftarrowfill{}");
|
||||
break;
|
||||
case InsetSpaceParams::RIGHTARROWFILL:
|
||||
os << (runparams.free_spacing && (runparams.for_search != OutputParams::NoSearch) ? " " : "\\rightarrowfill{}");
|
||||
os << (runparams.free_spacing && runparams.find_effective() ? " " : "\\rightarrowfill{}");
|
||||
break;
|
||||
case InsetSpaceParams::UPBRACEFILL:
|
||||
os << (runparams.free_spacing && (runparams.for_search != OutputParams::NoSearch) ? " " : "\\upbracefill{}");
|
||||
os << (runparams.free_spacing && runparams.find_effective() ? " " : "\\upbracefill{}");
|
||||
break;
|
||||
case InsetSpaceParams::DOWNBRACEFILL:
|
||||
os << (runparams.free_spacing && (runparams.for_search != OutputParams::NoSearch) ? " " : "\\downbracefill{}");
|
||||
os << (runparams.free_spacing && runparams.find_effective() ? " " : "\\downbracefill{}");
|
||||
break;
|
||||
case InsetSpaceParams::CUSTOM:
|
||||
if (runparams.free_spacing)
|
||||
@ -737,11 +737,10 @@ int InsetSpace::plaintext(odocstringstream & os,
|
||||
return 1;
|
||||
case InsetSpaceParams::PROTECTED:
|
||||
case InsetSpaceParams::CUSTOM_PROTECTED:
|
||||
if (runparams.for_search == OutputParams::NoSearch)
|
||||
os.put(0x00a0);
|
||||
else {
|
||||
if (runparams.find_effective())
|
||||
os.put(' ');
|
||||
}
|
||||
else
|
||||
os.put(0x00a0);
|
||||
return 1;
|
||||
case InsetSpaceParams::NEGTHIN:
|
||||
case InsetSpaceParams::NEGMEDIUM:
|
||||
|
@ -812,6 +812,17 @@ namespace {
|
||||
|
||||
typedef vector<pair<string, string> > Escapes;
|
||||
|
||||
static string getRegexSpaceCount(int count)
|
||||
{
|
||||
if (count > 0) {
|
||||
if (count > 1)
|
||||
return "\\s{" + std::to_string(count) + "}";
|
||||
else
|
||||
return "\\s";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
string string2regex(string in)
|
||||
{
|
||||
static std::regex specialChars { R"([-[\]{}()*+?.,\^$|#\$\\])" };
|
||||
@ -833,20 +844,14 @@ string string2regex(string in)
|
||||
}
|
||||
else {
|
||||
if (blanks > 0) {
|
||||
if (blanks > 1)
|
||||
temp += "\\s+";
|
||||
else
|
||||
temp += "\\s";
|
||||
temp += getRegexSpaceCount(blanks);
|
||||
}
|
||||
temp += tempx[i];
|
||||
blanks = 0;
|
||||
}
|
||||
}
|
||||
if (blanks > 0) {
|
||||
if (blanks > 1)
|
||||
temp += "\\s+";
|
||||
else
|
||||
temp += "\\s";
|
||||
temp += getRegexSpaceCount(blanks);
|
||||
}
|
||||
|
||||
string temp2("");
|
||||
@ -1153,11 +1158,11 @@ static docstring buffer_to_latex(Buffer & buffer)
|
||||
runparams.nice = true;
|
||||
setFindParams(runparams);
|
||||
if (ignoreFormats.getDeleted())
|
||||
runparams.for_search = OutputParams::SearchWithoutDeleted;
|
||||
runparams.find_set_feature(OutputParams::SearchWithoutDeleted);
|
||||
else
|
||||
runparams.for_search = OutputParams::SearchWithDeleted;
|
||||
runparams.find_set_feature(OutputParams::SearchWithDeleted);
|
||||
if (ignoreFormats.getNonContent()) {
|
||||
runparams.for_search |= OutputParams::SearchNonOutput;
|
||||
runparams.find_add_feature(OutputParams::SearchNonOutput);
|
||||
}
|
||||
pit_type const endpit = buffer.paragraphs().size();
|
||||
for (pit_type pit = 0; pit != endpit; ++pit) {
|
||||
@ -1231,13 +1236,13 @@ static docstring stringifySearchBuffer(Buffer & buffer, FindAndReplaceOptions co
|
||||
int option = AS_STR_INSETS |AS_STR_PLAINTEXT;
|
||||
if (ignoreFormats.getDeleted()) {
|
||||
option |= AS_STR_SKIPDELETE;
|
||||
runparams.for_search = OutputParams::SearchWithoutDeleted;
|
||||
runparams.find_set_feature(OutputParams::SearchWithoutDeleted);
|
||||
}
|
||||
else {
|
||||
runparams.for_search = OutputParams::SearchWithDeleted;
|
||||
runparams.find_set_feature(OutputParams::SearchWithDeleted);
|
||||
}
|
||||
if (ignoreFormats.getNonContent()) {
|
||||
runparams.for_search |= OutputParams::SearchNonOutput;
|
||||
runparams.find_add_feature(OutputParams::SearchNonOutput);
|
||||
}
|
||||
string t("");
|
||||
for (pos_type pit = pos_type(0); pit < (pos_type)buffer.paragraphs().size(); ++pit) {
|
||||
@ -4014,13 +4019,13 @@ docstring stringifyFromCursor(DocIterator const & cur, int len)
|
||||
int option = AS_STR_INSETS | AS_STR_PLAINTEXT;
|
||||
if (ignoreFormats.getDeleted()) {
|
||||
option |= AS_STR_SKIPDELETE;
|
||||
runparams.for_search = OutputParams::SearchWithoutDeleted;
|
||||
runparams.find_set_feature(OutputParams::SearchWithoutDeleted);
|
||||
}
|
||||
else {
|
||||
runparams.for_search = OutputParams::SearchWithDeleted;
|
||||
runparams.find_set_feature(OutputParams::SearchWithDeleted);
|
||||
}
|
||||
if (ignoreFormats.getNonContent()) {
|
||||
runparams.for_search |= OutputParams::SearchNonOutput;
|
||||
runparams.find_add_feature(OutputParams::SearchNonOutput);
|
||||
}
|
||||
LYXERR(Debug::FINDVERBOSE, "Stringifying with cur: "
|
||||
<< cur << ", from pos: " << cur.pos() << ", end: " << end);
|
||||
@ -4067,13 +4072,13 @@ docstring latexifyFromCursor(DocIterator const & cur, int len)
|
||||
runparams.nice = false;
|
||||
setFindParams(runparams);
|
||||
if (ignoreFormats.getDeleted()) {
|
||||
runparams.for_search = OutputParams::SearchWithoutDeleted;
|
||||
runparams.find_set_feature(OutputParams::SearchWithoutDeleted);
|
||||
}
|
||||
else {
|
||||
runparams.for_search = OutputParams::SearchWithDeleted;
|
||||
runparams.find_set_feature(OutputParams::SearchWithDeleted);
|
||||
}
|
||||
if (ignoreFormats.getNonContent()) {
|
||||
runparams.for_search |= OutputParams::SearchNonOutput;
|
||||
runparams.find_add_feature(OutputParams::SearchNonOutput);
|
||||
}
|
||||
|
||||
if (cur.inTexted()) {
|
||||
|
@ -2359,10 +2359,10 @@ int InsetMathHull::plaintext(odocstringstream & os,
|
||||
Encoding const * const enc = encodings.fromLyXName("utf8");
|
||||
|
||||
TeXMathStream::OutputType ot;
|
||||
if (op.for_search == OutputParams::NoSearch)
|
||||
ot = TeXMathStream::wsDefault;
|
||||
else
|
||||
if (op.find_effective())
|
||||
ot = TeXMathStream::wsSearchAdv;
|
||||
else
|
||||
ot = TeXMathStream::wsDefault;
|
||||
// Fix Bug #6139
|
||||
if (type_ == hullRegexp) {
|
||||
TeXMathStream wi(ots, false, true, ot, enc);
|
||||
|
@ -359,7 +359,7 @@ void InsetMathNest::normalize(NormalStream & os) const
|
||||
void InsetMathNest::latex(otexstream & os, OutputParams const & runparams) const
|
||||
{
|
||||
TeXMathStream::OutputType ot;
|
||||
if (runparams.for_search != OutputParams::NoSearch)
|
||||
if (runparams.find_effective())
|
||||
ot = TeXMathStream::wsSearchAdv;
|
||||
else if (runparams.dryrun)
|
||||
ot = TeXMathStream::wsDryrun;
|
||||
|
@ -462,10 +462,10 @@ void TeXEnvironment(Buffer const & buf, Text const & text,
|
||||
// Do not output empty environments if the whole paragraph has
|
||||
// been deleted with ct and changes are not output.
|
||||
bool output_changes;
|
||||
if (runparams.for_search == OutputParams::NoSearch)
|
||||
if (!runparams.find_effective())
|
||||
output_changes = buf.params().output_changes;
|
||||
else
|
||||
output_changes = ((runparams.for_search & OutputParams::SearchWithDeleted) != 0);
|
||||
output_changes = runparams.find_with_deleted();
|
||||
if (size_t(pit + 1) < paragraphs.size()) {
|
||||
ParagraphList::const_iterator nextpar = paragraphs.iterator_at(pit + 1);
|
||||
Paragraph const & cpar = paragraphs.at(pit);
|
||||
@ -578,7 +578,7 @@ void getArgInsets(otexstream & os, OutputParams const & runparams, Layout::LaTeX
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((runparams.for_search != OutputParams::NoSearch) && argnr > 1) {
|
||||
if (runparams.find_effective() && argnr > 1) {
|
||||
// Mark end of arguments for findadv() only
|
||||
os << "\\endarguments{}";
|
||||
}
|
||||
@ -746,7 +746,7 @@ void parStartCommand(Paragraph const & par, otexstream & os,
|
||||
break;
|
||||
case LATEX_ITEM_ENVIRONMENT:
|
||||
case LATEX_LIST_ENVIRONMENT:
|
||||
if (runparams.for_search != OutputParams::NoSearch) {
|
||||
if (runparams.find_effective()) {
|
||||
os << "\\" + style.itemcommand() << "{" << style.latexname() << "}";
|
||||
}
|
||||
else {
|
||||
@ -758,7 +758,7 @@ void parStartCommand(Paragraph const & par, otexstream & os,
|
||||
}
|
||||
break;
|
||||
case LATEX_ENVIRONMENT:
|
||||
if (runparams.for_search != OutputParams::NoSearch) {
|
||||
if (runparams.find_effective()) {
|
||||
os << "\\latexenvironment{" << style.latexname() << "}{";
|
||||
}
|
||||
break;
|
||||
@ -796,7 +796,7 @@ void TeXOnePar(Buffer const & buf,
|
||||
|
||||
// Do not output empty commands if the whole paragraph has
|
||||
// been deleted with ct and changes are not output.
|
||||
if (((runparams_in.for_search & OutputParams::SearchWithDeleted) == 0) && style.latextype != LATEX_ENVIRONMENT
|
||||
if (!runparams_in.find_with_deleted() && style.latextype != LATEX_ENVIRONMENT
|
||||
&& !par.empty() && par.isDeleted(0, par.size()) && !bparams.output_changes)
|
||||
return;
|
||||
|
||||
@ -936,7 +936,7 @@ void TeXOnePar(Buffer const & buf,
|
||||
bool const have_prior_nptpar =
|
||||
prior_nontitle_par && !prior_nontitle_par->isPassThru();
|
||||
Language const * const prev_language =
|
||||
runparams_in.for_search != OutputParams::NoSearch
|
||||
runparams_in.find_effective()
|
||||
? languages.getLanguage("ignore")
|
||||
: (have_prior_nptpar)
|
||||
? (use_prev_env_language
|
||||
@ -988,7 +988,7 @@ void TeXOnePar(Buffer const & buf,
|
||||
&& !(have_prior_nptpar
|
||||
&& (prev_language->rightToLeft() != par_language->rightToLeft()));
|
||||
bool const localswitch =
|
||||
(runparams_in.for_search != OutputParams::NoSearch
|
||||
(runparams_in.find_effective()
|
||||
|| text.inset().forceLocalFontSwitch()
|
||||
|| (using_begin_end && text.inset().forcePlainLayout())
|
||||
|| in_polyglossia_rtl_env)
|
||||
@ -1003,7 +1003,7 @@ void TeXOnePar(Buffer const & buf,
|
||||
bool const localswitch_needed = localswitch && par_lang != outer_lang;
|
||||
|
||||
// localswitches need to be closed and reopened at each par
|
||||
if ((runparams_in.for_search != OutputParams::NoSearch) || ((par_lang != prev_lang || localswitch_needed)
|
||||
if (runparams_in.find_effective() || ((par_lang != prev_lang || localswitch_needed)
|
||||
// check if we already put language command in TeXEnvironment()
|
||||
&& !(style.isEnvironment()
|
||||
&& (pit == 0 || (priorpar->layout() != par.layout()
|
||||
@ -1071,7 +1071,7 @@ void TeXOnePar(Buffer const & buf,
|
||||
// With CJK, the CJK tag has to be closed first (see below)
|
||||
if ((runparams.encoding->package() != Encoding::CJK
|
||||
|| bparams.useNonTeXFonts
|
||||
|| (runparams.for_search != OutputParams::NoSearch))
|
||||
|| runparams.find_effective())
|
||||
&& (par_lang != openLanguageName(state) || localswitch || intitle_command)
|
||||
&& !par_lang.empty()) {
|
||||
string bc = use_polyglossia ?
|
||||
@ -1312,7 +1312,7 @@ void TeXOnePar(Buffer const & buf,
|
||||
// when the paragraph uses CJK, the language has to be closed earlier
|
||||
if ((font.language()->encoding()->package() != Encoding::CJK)
|
||||
|| bparams.useNonTeXFonts
|
||||
|| (runparams_in.for_search != OutputParams::NoSearch)) {
|
||||
|| runparams_in.find_effective()) {
|
||||
if (lang_end_command.empty()) {
|
||||
// If this is a child, we should restore the
|
||||
// master language after the last paragraph.
|
||||
@ -1708,10 +1708,10 @@ void latexParagraphs(Buffer const & buf,
|
||||
// Do not output empty environments if the whole paragraph has
|
||||
// been deleted with ct and changes are not output.
|
||||
bool output_changes;
|
||||
if (runparams.for_search == OutputParams::NoSearch)
|
||||
if (!runparams.find_effective())
|
||||
output_changes = bparams.output_changes;
|
||||
else
|
||||
output_changes = ((runparams.for_search & OutputParams::SearchWithDeleted) != 0);
|
||||
output_changes = runparams.find_with_deleted();
|
||||
bool const lastpar = size_t(pit + 1) >= paragraphs.size();
|
||||
if (!lastpar) {
|
||||
ParagraphList::const_iterator nextpar = paragraphs.iterator_at(pit + 1);
|
||||
@ -1854,7 +1854,7 @@ pair<bool, int> switchEncoding(odocstream & os, BufferParams const & bparams,
|
||||
|| oldEnc.package() == Encoding::japanese
|
||||
|| oldEnc.package() == Encoding::none
|
||||
|| newEnc.package() == Encoding::none
|
||||
|| (runparams.for_search != OutputParams::NoSearch))
|
||||
|| runparams.find_effective())
|
||||
return make_pair(false, 0);
|
||||
// FIXME We ignore encoding switches from/to encodings that do
|
||||
// neither support the inputenc package nor the CJK package here.
|
||||
|
Loading…
Reference in New Issue
Block a user