From cbe2f613969fe92d9c14231f48d19749674f8e26 Mon Sep 17 00:00:00 2001 From: Kornel Benko Date: Sat, 30 Apr 2022 09:30:15 +0200 Subject: [PATCH] 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 514bf03725..7b7585df20 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 c0d86409f9..ee92523551 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); -- 2.39.5