]> git.lyx.org Git - features.git/commitdiff
FindAdv: Added lyx-function search-ignore
authorKornel Benko <kornel@lyx.org>
Thu, 15 Nov 2018 13:20:50 +0000 (14:20 +0100)
committerKornel Benko <kornel@lyx.org>
Thu, 15 Nov 2018 13:20:50 +0000 (14:20 +0100)
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
src/LyXAction.cpp
src/Text3.cpp
src/lyxfind.cpp

index 3798786018df347a3aafa5c815c64f26cf31f32e..14b9ba152ffbd756f7ef62ff285192cff3fbbb73 100644 (file)
@@ -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
 };
 
index 39cad0d0d4df4a83e38623a56dcacbf5cf449edb..f5ed3f87873f5c803a5ac5177db75c7434808d85 100644 (file)
@@ -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 <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.
index de795838aa21eba71dfe04a98030cf51d0248bd3..45eb8155f2780dad55aa5875ea7da0c1c65df382 100644 (file)
@@ -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;
        }
index 2fd36e289e1ea537f85356b7481c31bd5d688bbe..a5ea0c03944e84113ff19c0d2451ac23e7f4b018 100644 (file)
@@ -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);