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
This commit is contained in:
Kornel Benko 2018-11-15 14:20:50 +01:00
parent 702c495e98
commit 06c05430d9
4 changed files with 22 additions and 1 deletions

View File

@ -481,6 +481,7 @@ enum FuncCode
LFUN_MASTER_BUFFER_EXPORT, // rkh, 20180417 LFUN_MASTER_BUFFER_EXPORT, // rkh, 20180417
LFUN_INSET_END_EDIT, // gb/rkh, 20180605 LFUN_INSET_END_EDIT, // gb/rkh, 20180605
// 375 // 375
LFUN_SEARCH_IGNORE, // kornel, 20181115
LFUN_LASTACTION // end of the table LFUN_LASTACTION // end of the table
}; };

View File

@ -3375,6 +3375,16 @@ void LyXAction::init()
*/ */
{ LFUN_REPEAT, "repeat", NoBuffer, Edit }, { 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 * \var lyx::FuncCode lyx::LFUN_SCREEN_DOWN
* \li Action: Moves the cursor one page in downward direction. * \li Action: Moves the cursor one page in downward direction.

View File

@ -80,6 +80,7 @@
#include "mathed/InsetMathHull.h" #include "mathed/InsetMathHull.h"
#include "mathed/InsetMathMacroTemplate.h" #include "mathed/InsetMathMacroTemplate.h"
#include "lyxfind.h"
#include <clocale> #include <clocale>
#include <sstream> #include <sstream>
@ -3454,6 +3455,12 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
break; break;
} }
case LFUN_SEARCH_IGNORE: {
bool const value = cmd.getArg(1) == "true";
setIgnoreFormat(cmd.getArg(0), value);
break;
}
default: default:
return false; return false;
} }

View File

@ -1638,7 +1638,7 @@ void LatexInfo::buildKeys(bool isPatternString)
// Macros to remove, but let the parameter survive // Macros to remove, but let the parameter survive
// No split // 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) // Same effect as previous, parameter will survive (because there is no one anyway)
// No split // No split
@ -1994,6 +1994,9 @@ int LatexInfo::process(ostringstream &os, KeyInfo &actual )
output_end = interval.nextNotIgnored(actual._dataEnd); output_end = interval.nextNotIgnored(actual._dataEnd);
else else
output_end = interval.nextNotIgnored(end); 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) if (interval.nextNotIgnored(actual._dataStart) < output_end)
interval.output(os, output_end); interval.output(os, output_end);
interval.addIntervall(actual._tokenstart, end); interval.addIntervall(actual._tokenstart, end);