]> git.lyx.org Git - lyx.git/blobdiff - src/Text3.cpp
Some comments.
[lyx.git] / src / Text3.cpp
index 28ae7995fa5cd9bdca5ec8ad9c442498cd2716f3..b63f7aa7c8fed00f44b8e516e5fe198b55a76556 100644 (file)
@@ -131,7 +131,9 @@ static void mathDispatch(Cursor & cur, FuncRequest const & cmd, bool display)
                const int old_pos = cur.pos();
 #endif
                cur.insert(new InsetMathHull(hullSimple));
-               BOOST_ASSERT(old_pos == cur.pos());
+#ifdef ENABLE_ASSERTIONS
+               LASSERT(old_pos == cur.pos(), /**/);
+#endif
                cur.nextInset()->edit(cur, true);
                // don't do that also for LFUN_MATH_MODE
                // unless you want end up with always changing
@@ -284,6 +286,9 @@ static void outline(OutlineOp mode, Cursor & cur)
 
        switch (mode) {
                case OutlineUp: {
+                       if (start == pars.begin())
+                               // Nothing to move.
+                               return;
                        ParagraphList::iterator dest = start;
                        // Move out (up) from this header
                        if (dest == bgn)
@@ -309,7 +314,19 @@ static void outline(OutlineOp mode, Cursor & cur)
                        return;
                }
                case OutlineDown: {
-                       ParagraphList::iterator dest = finish;
+                       if (finish == end)
+                               // Nothing to move.
+                               return;
+                       // Go one down from *this* header:
+                       ParagraphList::iterator dest = boost::next(finish, 1);
+                       // Go further down to find header to insert in front of:
+                       for (; dest != end; ++dest) {
+                               toclevel = dest->layout().toclevel;
+                               if (toclevel != Layout::NOT_IN_TOC
+                                   && toclevel <= thistoclevel) {
+                                       break;
+                               }
+                       }
                        // One such was found:
                        pit_type newpit = distance(bgn, dest);
                        pit_type const len = distance(start, finish);
@@ -390,7 +407,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
        // at the end?
        cur.noUpdate();
 
-       BOOST_ASSERT(cur.text() == this);
+       LASSERT(cur.text() == this, /**/);
        CursorSlice oldTopSlice = cur.top();
        bool oldBoundary = cur.boundary();
        bool sel = cur.selection();
@@ -924,7 +941,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                        else if (arg == "linkback")
                                type = Clipboard::LinkBackGraphicsType;
                        else
-                               BOOST_ASSERT(false);
+                               LASSERT(false, /**/);
 
                        pasteClipboardGraphics(cur, bv->buffer().errorList("Paste"), type);
                }
@@ -964,15 +981,6 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                break;
        }
 
-       case LFUN_SERVER_GET_FONT:
-               if (cur.current_font.fontInfo().shape() == ITALIC_SHAPE)
-                       cur.message(from_ascii("E"));
-               else if (cur.current_font.fontInfo().shape() == SMALLCAPS_SHAPE)
-                       cur.message(from_ascii("N"));
-               else
-                       cur.message(from_ascii("0"));
-               break;
-
        case LFUN_SERVER_GET_LAYOUT:
                cur.message(cur.paragraph().layout().name());
                break;
@@ -1487,7 +1495,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                cap::replaceSelection(cur);
                cur.insert(new InsetMathHull(hullSimple));
                checkAndActivateInset(cur, true);
-               BOOST_ASSERT(cur.inMathed());
+               LASSERT(cur.inMathed(), /**/);
                cur.dispatch(cmd);
                break;
        }
@@ -1827,7 +1835,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
 bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
                        FuncStatus & flag) const
 {
-       BOOST_ASSERT(cur.text() == this);
+       LASSERT(cur.text() == this, /**/);
 
        Font const & font = cur.real_current_font;
        FontInfo const & fontinfo = font.fontInfo();
@@ -2167,7 +2175,6 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
        case LFUN_CHARS_TRANSPOSE:
        case LFUN_SERVER_GET_XY:
        case LFUN_SERVER_SET_XY:
-       case LFUN_SERVER_GET_FONT:
        case LFUN_SERVER_GET_LAYOUT:
        case LFUN_LAYOUT:
        case LFUN_DATE_INSERT: