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

Pavel Sanda <[email protected]>
Newsgroups gmane.editors.lyx.cvs
Message-ID <[email protected]>
commit 9a00d9a13e6d3f8d1d36b5ec4c0c4cf41172af00
Author: Pavel Sanda <[email protected]>
Date:   Tue Aug 18 02:37:44 2026 +0200

    Fix #13350 - Font changes should not be allowed for passthru.
    
    Backporting eae3cfd.
    
    Assisted-by: Claude Opus 4.8
---
 src/Text.cpp | 9 ++++++++-
 status.25x   | 4 ++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/Text.cpp b/src/Text.cpp
index f710b753ff..a262821350 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -2807,6 +2807,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
@@ -7121,7 +7128,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:
diff --git a/status.25x b/status.25x
index 40f865a1b4..184ba9a63c 100644
--- a/status.25x
+++ b/status.25x
@@ -29,6 +29,10 @@ What's new
 
 - Fix autoselect filter on Citation dialog (bug #13333).
 
+- Font changes should not be allowed for passthru environment
+  (e.g. verbatim). Fixes bug #13350.
+
+
 * DOCUMENTATION AND LOCALIZATION
 
 
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.