Am Samstag, dem 02.04.2022 um 09:38 +0200 schrieb Kornel Benko:
> But they do not appear in latex output, thus are never accessible by
> searchadv.

Like so (untested)?

In any case, I think the testing should be done in InsetNote::latex(),
not InsetText::latex().

Jürgen
diff --git a/src/insets/InsetNote.cpp b/src/insets/InsetNote.cpp
index adacef3bae..05253de855 100644
--- a/src/insets/InsetNote.cpp
+++ b/src/insets/InsetNote.cpp
@@ -206,9 +206,19 @@ bool InsetNote::isMacroScope() const
 
 void InsetNote::latex(otexstream & os, OutputParams const & runparams_in) const
 {
-	if (params_.type == InsetNoteParams::Note)
+	if (params_.type != InsetNoteParams::Greyedout
+	    && (runparams_in.for_searchAdv & OutputParams::SearchNonOutput) == 0)
 		return;
 
+	if (params_.type == InsetNoteParams::Note) {
+		if ((runparams_in.for_searchAdv & OutputParams::SearchNonOutput) != 0) {
+			OutputParams runparams(runparams_in);
+			InsetCollapsible::latex(os, runparams);
+			runparams_in.encoding = runparams.encoding;
+		}
+		return;
+	}
+
 	OutputParams runparams(runparams_in);
 	if (params_.type == InsetNoteParams::Comment) {
 		runparams.inComment = true;
diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp
index af1847cbaf..c67e934add 100644
--- a/src/insets/InsetText.cpp
+++ b/src/insets/InsetText.cpp
@@ -485,12 +485,6 @@ void InsetText::latex(otexstream & os, OutputParams const & runparams) const
 	// environment. Standard collapsible insets should not
 	// redefine this, non-standard ones may call this.
 	InsetLayout const & il = getLayout();
-	if (runparams.for_searchAdv != OutputParams::NoSearch &&
-	    (runparams.for_searchAdv & OutputParams::SearchNonOutput) == 0 &&
-	    !il.latexname().empty() &&
-	    il.latextype() == InsetLaTeXType::ENVIRONMENT &&
-	    il.latexname() == "comment")
-		return;
 
 	if (il.forceOwnlines())
 		os << breakln;

Attachment: signature.asc
Description: This is a digitally signed message part

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to