Author: baum
Date: Fri Jan 14 21:06:15 2011
New Revision: 37214
URL: http://www.lyx.org/trac/changeset/37214

Log:
Ignore \protect if it is directly in front of \LyX{} (otherwise it would
accumulate for each round trip, since LyX  writes \protect if needed)

Modified:
   lyx-devel/trunk/src/tex2lyx/text.cpp

Modified: lyx-devel/trunk/src/tex2lyx/text.cpp
==============================================================================
--- lyx-devel/trunk/src/tex2lyx/text.cpp        Fri Jan 14 21:00:55 2011        
(r37213)
+++ lyx-devel/trunk/src/tex2lyx/text.cpp        Fri Jan 14 21:06:15 2011        
(r37214)
@@ -2134,9 +2134,15 @@
                        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);

Reply via email to