]> git.lyx.org Git - lyx.git/blobdiff - src/text.C
bug 2298: cursorTop/Bottom/Home/End does not redraw after dEPM
[lyx.git] / src / text.C
index d3f8b3b2e16fb8bc7f59a41d34fd7be02ef25564..9746afc7b25d30288466e8e429ddf42dbdc2d48c 100644 (file)
@@ -1681,9 +1681,12 @@ bool LyXText::backspace(LCursor & cur)
                        // Previous paragraph, mark "carriage return" as
                        // deleted:
                        Paragraph & par = pars_[cur.pit() - 1];
-                       par.setChange(par.size(), Change::DELETED);
-                       setCursorIntern(cur, cur.pit() - 1, par.size());
-                       return false;
+                       // Take care of a just inserted para break:
+                       if (par.lookupChange(par.size()) != Change::INSERTED) {
+                               par.setChange(par.size(), Change::DELETED);
+                               setCursorIntern(cur, cur.pit() - 1, par.size());
+                               return false;
+                       }
                }
 
                needsUpdate = backspacePos0(cur);
@@ -2318,8 +2321,25 @@ string LyXText::getPossibleLabel(LCursor & cur) const
                }
        }
 
-       string text = layout->latexname().substr(0, 3);
-       if (layout->latexname() == "theorem")
+       string name = layout->latexname();
+
+       // for captions, we want the abbreviation of the float type
+       if (layout->labeltype == LABEL_SENSITIVE) {
+               // Search for the first float or wrap inset in the iterator
+               size_t i = cur.depth();
+               while (i > 0) {
+                       --i;
+                       InsetBase * const in = &cur[i].inset();
+                       if (in->lyxCode() == InsetBase::FLOAT_CODE
+                           || in->lyxCode() == InsetBase::WRAP_CODE) {
+                               name = in->getInsetName();
+                               break;
+                       }
+               }
+       }
+
+       string text = name.substr(0, 3);
+       if (name == "theorem")
                text = "thm"; // Create a correct prefix for prettyref
 
        text += ':';