[LyX/master] FindAdv: Re-add 'size' to the list of possible ignored formats

Kornel Benko kornel at lyx.org
Sat Apr 30 06:52:52 UTC 2022


commit cbe2f613969fe92d9c14231f48d19749674f8e26
Author: Kornel Benko <kornel at lyx.org>
Date:   Sat Apr 30 09:30:15 2022 +0200

    FindAdv: Re-add 'size' to the list of possible ignored formats
---
 src/Font.cpp    |   17 ++++++++++++-----
 src/lyxfind.cpp |    9 ++++++++-
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/src/Font.cpp b/src/Font.cpp
index 514bf03..7b7585d 100644
--- a/src/Font.cpp
+++ b/src/Font.cpp
@@ -336,11 +336,18 @@ int Font::latexWriteStartChanges(otexstream & os, BufferParams const & bparams,
 	p.reduce(prev.bits_);
 
 	if (f.size() != INHERIT_SIZE) {
-		os << '{';
-		++count;
-		os << '\\'
-		   << LaTeXSizeSwitchNames[f.size()] << termcmd;
-		count += strlen(LaTeXSizeSwitchNames[f.size()]) + 1;
+		if (runparams.for_search == OutputParams::NoSearch) {
+			os << '{';
+			++count;
+			os << '\\'
+			   << LaTeXSizeSwitchNames[f.size()] << termcmd;
+			count += strlen(LaTeXSizeSwitchNames[f.size()]) + 1;
+		}
+		else {
+			os << '\\'
+			   << LaTeXSizeSwitchNames[f.size()] << '{';
+			count += strlen(LaTeXSizeSwitchNames[f.size()]) + 2;
+		}
 	}
 	if (f.family() != INHERIT_FAMILY) {
 		if (non_inherit_inset) {
diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
index c0d8640..ee92523 100644
--- a/src/lyxfind.cpp
+++ b/src/lyxfind.cpp
@@ -88,6 +88,8 @@ class IgnoreFormats {
 	///
 	bool getShape() const { return ignoreShape_; }
 	///
+	bool getSize() const { return ignoreSize_; }
+	///
 	bool getUnderline() const { return ignoreUnderline_; }
 	///
 	bool getMarkUp() const { return ignoreMarkUp_; }
@@ -118,6 +120,8 @@ private:
 	///
 	bool ignoreShape_ = false;
 	///
+	bool ignoreSize_ = true;
+	///
 	bool ignoreUnderline_ = false;
 	///
 	bool ignoreMarkUp_ = false;
@@ -166,6 +170,9 @@ void IgnoreFormats::setIgnoreFormat(string const & type, bool value, bool fromUs
 	else if (type == "shape") {
 		ignoreShape_ = value;
 	}
+	else if (type == "size") {
+		ignoreSize_ = value;
+	}
 	else if (type == "family") {
 		ignoreFamily_ = value;
 	}
@@ -2757,7 +2764,7 @@ void LatexInfo::buildKeys(bool isPatternString)
 	makeKey("textgreek|textcyrillic", KeyInfo(KeyInfo::isStandard, 1, true), false);
 	makeKey("parbox", KeyInfo(KeyInfo::doRemove, 1, true), isPatternString);
 	// like ('tiny{}' or '\tiny ' ... )
-	makeKey("footnotesize|tiny|scriptsize|small|large|Large|LARGE|huge|Huge", KeyInfo(KeyInfo::isSize, 0, false), isPatternString);
+	makeKey("footnotesize|tiny|scriptsize|small|large|Large|LARGE|huge|Huge", KeyInfo(KeyInfo::isSize, 0, ignoreFormats.getSize()), isPatternString);
 
 	// Survives, like known character
 	// makeKey("lyx|LyX|latex|LaTeX|latexe|LaTeXe|tex|TeX", KeyInfo(KeyInfo::isChar, 0, false), isPatternString);


More information about the lyx-cvs mailing list