[LyX/master] Fix #13350 - Font changes should not be allowed for passthru.

Pavel Sanda <[email protected]> Mon, 27 Jul 2026 20:14:55 +0000
Newsgroups gmane.editors.lyx.cvs
Message-ID <[email protected]>
commit eae3cfde6c22986f5e250095389ac3c7062eb565
Author: Pavel Sanda <[email protected]>
Date:   Mon Jul 27 21:29:14 2026 +0200

    Fix #13350 - Font changes should not be allowed for passthru.
    
    Reviewed by Juergen.
    
    Assisted-by: Claude Opus 4.8
---
 src/Text.cpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/Text.cpp b/src/Text.cpp
index 3c8e7d50f7..22e1c2c87b 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -2769,6 +2769,13 @@ void Text::setFont(BufferView const & bv, CursorSlice const & begin,
 			continue;
 		pit_type const pit = dit.pit();
 		pos_type const pos = dit.pos();
+		// Do not apply font changes to passthru (e.g. Verbatim)
+		// paragraphs: they would be output as literal LaTeX code
+		// (\textcolor{...}{...} etc.) rather than rendered (bug 13350).
+		// Checking per position also covers a selection that spans
+		// both passthru and normal paragraphs.
+		if (pars_[pit].isPassThru())
+			continue;
 		Inset * inset = pars_[pit].getInset(pos);
 		if (inset && inset->resetFontEdit()) {
 			// We need to propagate the font change to all
@@ -7114,7 +7121,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
 	}
 
 	case LFUN_TEXTSTYLE_APPLY:
-		enable = !freeFonts.empty();
+		enable = !freeFonts.empty() && !cur.paragraph().isPassThru();
 		break;
 
 	case LFUN_WORD_DELETE_FORWARD:
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs