[LyX/master] Avoid loop in math parsing function

Juergen Spitzmueller spitz at lyx.org
Thu Jul 25 07:18:30 UTC 2024


commit 003bbd3483c9697a3d5105b26cb43a95ef20a0e8
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Thu Jul 25 09:18:01 2024 +0200

    Avoid loop in math parsing function
---
 src/Encoding.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/Encoding.cpp b/src/Encoding.cpp
index 675834f63f..33ae59045c 100644
--- a/src/Encoding.cpp
+++ b/src/Encoding.cpp
@@ -663,7 +663,13 @@ docstring Encodings::convertLaTeXCommands(docstring const & str, bool const for_
 					if (cmd.empty())
 						break;
 					// go on ...
+					docstring oldrem = rem;
 					ret += fromLaTeXCommand(from_ascii("\\") + cmd, MATH_CMD, termination, rem);
+					if (oldrem == rem) {
+						// Result unchanged, output
+						ret += rem;
+						break;
+					}
 				}
 				mret = docstring();
 			}


More information about the lyx-cvs mailing list