[LyX/master] Fix wrong \inputencoding after a command paragraph closes
Udi Fogiel <[email protected]> Thu, 09 Jul 2026 15:30:21 +0000
| Newsgroups | gmane.editors.lyx.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit bf8fd567d4c33fba5136730e96fe39e1cd63efeb Author: Udi Fogiel <[email protected]> Date: Thu Jul 9 18:29:33 2026 +0300 Fix wrong \inputencoding after a command paragraph closes for example a title that contains an input encoding switch. Fixes #12927. --- src/output_latex.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/output_latex.cpp b/src/output_latex.cpp index 2e571df1ce..94ed36b3f3 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -1158,6 +1158,13 @@ void TeXOnePar(Buffer const & buf, } } + // Remember the encoding in effect before this paragraph, so that it can be + // restored once a command argument (e.g. \title{...}) that brace-groups its + // content closes. This must be captured before the look-ahead switch below, + // which may move a later encoding change to the beginning of the paragraph + // and would otherwise corrupt the value to restore to. + Encoding const * const orig_encoding = runparams.encoding; + // Switch file encoding if necessary; no need to do this for "auto-legacy-plain" // encoding, since this only affects the position of the outputted // \inputencoding command; the encoding switch will occur when necessary @@ -1223,7 +1230,7 @@ void TeXOnePar(Buffer const & buf, runparams.moving_arg |= style.needprotect; if (style.needmboxprotect) ++runparams.inulemcmd; - Encoding const * const prev_encoding = runparams.encoding; + Encoding const * const prev_encoding = orig_encoding; bool const useSetSpace = bparams.documentClass().provides("SetSpace"); if (par.allowParagraphCustomization()) { -- lyx-cvs mailing list [email protected] https://lists.lyx.org/mailman/listinfo/lyx-cvs