From: Kornel Benko Date: Thu, 15 Nov 2018 13:20:50 +0000 (+0100) Subject: FindAdv: Added lyx-function search-ignore X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=d76bc60d93443f6047a01e3b904b5249cc6fee80;p=features.git FindAdv: Added lyx-function search-ignore Enable/disable ignoring the specified type language: e.g. british, slovak, latin, ... color: blue, red, ... sectioning: part, chapter, .. font: series: bold, ... shape: upright, italic, slanted family: serif, monospace ... markup: enphasize, noun underline: strike: Examples: search-ignore language true search-ignore shape true --- diff --git a/src/FuncCode.h b/src/FuncCode.h index 3798786018..14b9ba152f 100644 --- a/src/FuncCode.h +++ b/src/FuncCode.h @@ -481,6 +481,7 @@ enum FuncCode LFUN_MASTER_BUFFER_EXPORT, // rkh, 20180417 LFUN_INSET_END_EDIT, // gb/rkh, 20180605 // 375 + LFUN_SEARCH_IGNORE, // kornel, 20181115 LFUN_LASTACTION // end of the table }; diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp index 39cad0d0d4..f5ed3f8787 100644 --- a/src/LyXAction.cpp +++ b/src/LyXAction.cpp @@ -3375,6 +3375,16 @@ void LyXAction::init() */ { LFUN_REPEAT, "repeat", NoBuffer, Edit }, +/*! + * \var lyx::FuncCode lyx::LFUN_SEARCH_IGNORE + * \li Action: Enables/disables searching for features in findadv + * \li Syntax: search-ignore + * \li Params: : language|color|sectioning|font|series|shape|family|markup|underline|strike + * \li Params: : true|false + * \endvar + */ + { LFUN_SEARCH_IGNORE, "search-ignore", ReadOnly|NoBuffer|NoUpdate, System }, + /*! * \var lyx::FuncCode lyx::LFUN_SCREEN_DOWN * \li Action: Moves the cursor one page in downward direction. diff --git a/src/Text3.cpp b/src/Text3.cpp index de795838aa..45eb8155f2 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -80,6 +80,7 @@ #include "mathed/InsetMathHull.h" #include "mathed/InsetMathMacroTemplate.h" +#include "lyxfind.h" #include #include @@ -3454,6 +3455,12 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd, break; } + case LFUN_SEARCH_IGNORE: { + bool const value = cmd.getArg(1) == "true"; + setIgnoreFormat(cmd.getArg(0), value); + break; + } + default: return false; } diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index 2fd36e289e..a5ea0c0394 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -1638,7 +1638,7 @@ void LatexInfo::buildKeys(bool isPatternString) // Macros to remove, but let the parameter survive // No split - makeKey("url|href|menuitem|footnote|code|index|textmd", KeyInfo(KeyInfo::isStandard, 1, true), isPatternString); + makeKey("url|href|menuitem|footnote|code|index|textmd|textrm", KeyInfo(KeyInfo::isStandard, 1, true), isPatternString); // Same effect as previous, parameter will survive (because there is no one anyway) // No split @@ -1994,6 +1994,9 @@ int LatexInfo::process(ostringstream &os, KeyInfo &actual ) output_end = interval.nextNotIgnored(actual._dataEnd); else output_end = interval.nextNotIgnored(end); + if ((actual.keytype == KeyInfo::isMain) && actual.disabled) { + interval.addIntervall(actual._tokenstart, actual._tokenstart+actual._tokensize); + } if (interval.nextNotIgnored(actual._dataStart) < output_end) interval.output(os, output_end); interval.addIntervall(actual._tokenstart, end);