From 7a74bbf06be0f7e11a05949ff822e3f512b91814 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Fri, 14 Jan 2011 20:06:15 +0000 Subject: [PATCH] Ignore \protect if it is directly in front of \LyX{} (otherwise it would accumulate for each round trip, since LyX writes \protect if needed) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37214 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/tex2lyx/text.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp index ff1dbbf91f..556b839cf6 100644 --- a/src/tex2lyx/text.cpp +++ b/src/tex2lyx/text.cpp @@ -2134,9 +2134,15 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer, os << "\\lyxline"; } - else if (is_known(t.cs(), known_phrases)) { + else if (is_known(t.cs(), known_phrases) || + (t.cs() == "protect" && + p.next_token().cat() == catEscape && + is_known(p.next_token().cs(), known_phrases))) { + // LyX sometimes puts a \protect in front, so we have to ignore it // FIXME: This needs to be changed when bug 4752 is fixed. - char const * const * where = is_known(t.cs(), known_phrases); + char const * const * where = is_known( + t.cs() == "protect" ? p.get_token().cs() : t.cs(), + known_phrases); context.check_layout(os); os << known_coded_phrases[where - known_phrases]; skip_spaces_braces(p);