commit 06c05430d99365a48955b50b8be71ce1eaa82c78
Author: Kornel Benko <[email protected]>
Date: Thu Nov 15 14:20:50 2018 +0100
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
---
src/FuncCode.h | 1 +
src/LyXAction.cpp | 10 ++++++++++
src/Text3.cpp | 7 +++++++
src/lyxfind.cpp | 5 ++++-
4 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/src/FuncCode.h b/src/FuncCode.h
index 3798786..14b9ba1 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 39cad0d..f5ed3f8 100644
--- a/src/LyXAction.cpp
+++ b/src/LyXAction.cpp
@@ -3376,6 +3376,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 <type> <value>
+ * \li Params: <type>:
language|color|sectioning|font|series|shape|family|markup|underline|strike
+ * \li Params: <value>: 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.
* \li Syntax: screen-down
diff --git a/src/Text3.cpp b/src/Text3.cpp
index de79583..45eb815 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 <clocale>
#include <sstream>
@@ -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 2fd36e2..a5ea0c0 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);