]> git.lyx.org Git - lyx.git/blobdiff - src/lyxtextclass.C
Fix deleting of paragraphs after undo (fix #236).
[lyx.git] / src / lyxtextclass.C
index 6c368bb7b89edd7a653f2e4af6eaeeaa43769749..7f6a668ff464adfee5de6161a4246f86ccfaf8d6 100644 (file)
@@ -512,6 +512,13 @@ LyXLayout const & LyXTextClass::operator[](string const & n) const
                lyxerr << "Operator[] called with empty n" << endl;
        
        string const name = (n.empty() ? defaultLayoutName() : n);
+
+       static string lastLayoutName;
+       static LayoutList::difference_type lastLayoutIndex;
+
+       if (name == lastLayoutName)
+               return layoutlist[lastLayoutIndex];
+
        
        LayoutList::const_iterator cit =
                find_if(layoutlist.begin(),
@@ -527,6 +534,9 @@ LyXLayout const & LyXTextClass::operator[](string const & n) const
                lyx::Assert(false);
        }
 
+       lastLayoutName = name;
+       lastLayoutIndex = std::distance(layoutlist.begin(), cit);
+       
        return *cit;
 }