]> git.lyx.org Git - lyx.git/blobdiff - src/Text2.cpp
Account for old versions of Pygments
[lyx.git] / src / Text2.cpp
index 5a41761c301f29013e7df7244a9160e4aa90ccee..d7d4319d0f715ed85d3f4e0a01f9adb80a27f714 100644 (file)
@@ -22,7 +22,6 @@
 
 #include "Text.h"
 
-#include "Bidi.h"
 #include "Buffer.h"
 #include "buffer_funcs.h"
 #include "BufferList.h"
@@ -338,6 +337,8 @@ void Text::setFont(Cursor & cur, Font const & font, bool toggleall)
                        newfi.setUnderbar(oldfi.underbar() == FONT_OFF ? FONT_ON : FONT_OFF);
                if (newfi.strikeout() == FONT_TOGGLE)
                        newfi.setStrikeout(oldfi.strikeout() == FONT_OFF ? FONT_ON : FONT_OFF);
+               if (newfi.xout() == FONT_TOGGLE)
+                       newfi.setXout(oldfi.xout() == FONT_OFF ? FONT_ON : FONT_OFF);
                if (newfi.uuline() == FONT_TOGGLE)
                        newfi.setUuline(oldfi.uuline() == FONT_OFF ? FONT_ON : FONT_OFF);
                if (newfi.uwave() == FONT_TOGGLE)
@@ -548,47 +549,23 @@ void Text::insertInset(Cursor & cur, Inset * inset)
 }
 
 
-bool Text::setCursor(Cursor & cur, pit_type par, pos_type pos,
+bool Text::setCursor(Cursor & cur, pit_type pit, pos_type pos,
                        bool setfont, bool boundary)
 {
        TextMetrics const & tm = cur.bv().textMetrics(this);
-       bool const update_needed = !tm.contains(par);
+       bool const update_needed = !tm.contains(pit);
        Cursor old = cur;
-       setCursorIntern(cur, par, pos, setfont, boundary);
+       setCursorIntern(cur, pit, pos, setfont, boundary);
        return cur.bv().checkDepm(cur, old) || update_needed;
 }
 
 
-void Text::setCursor(CursorSlice & cur, pit_type par, pos_type pos)
-{
-       LASSERT(par != int(paragraphs().size()), return);
-       cur.pit() = par;
-       cur.pos() = pos;
-
-       // now some strict checking
-       Paragraph & para = getPar(par);
-
-       // None of these should happen, but we're scaredy-cats
-       if (pos < 0) {
-               LYXERR0("Don't like -1!");
-               LATTEST(false);
-       }
-
-       if (pos > para.size()) {
-               LYXERR0("Don't like 1, pos: " << pos
-                      << " size: " << para.size()
-                      << " par: " << par);
-               LATTEST(false);
-       }
-}
-
-
-void Text::setCursorIntern(Cursor & cur,
-                             pit_type par, pos_type pos, bool setfont, bool boundary)
+void Text::setCursorIntern(Cursor & cur, pit_type pit, pos_type pos,
+                           bool setfont, bool boundary)
 {
        LBUFERR(this == cur.text());
        cur.boundary(boundary);
-       setCursor(cur.top(), par, pos);
+       cur.top().setPitPos(pit, pos);
        if (setfont)
                cur.setCurrentFont();
 }
@@ -615,6 +592,8 @@ bool Text::checkAndActivateInset(Cursor & cur, bool front)
        if (!front)
                --cur.pos();
        inset->edit(cur, front);
+       cur.setCurrentFont();
+       cur.boundary(false);
        return true;
 }
 
@@ -633,6 +612,8 @@ bool Text::checkAndActivateInsetVisual(Cursor & cur, bool movingForward, bool mo
                return false;
        inset->edit(cur, movingForward, 
                movingLeft ? Inset::ENTRY_DIRECTION_RIGHT : Inset::ENTRY_DIRECTION_LEFT);
+       cur.setCurrentFont();
+       cur.boundary(false);
        return true;
 }
 
@@ -905,7 +886,7 @@ bool Text::deleteEmptyParagraphMechanism(Cursor & cur,
                               min(old.pit() + 1, old.lastpit()));
                ParagraphList & plist = old.text()->paragraphs();
                bool const soa = oldpar.params().startOfAppendix();
-               plist.erase(next(plist.begin(), old.pit()));
+               plist.erase(lyx::next(plist.begin(), old.pit()));
                // do not lose start of appendix marker (bug 4212)
                if (soa && old.pit() < pit_type(plist.size()))
                        plist[old.pit()].params().startOfAppendix(true);
@@ -969,7 +950,7 @@ void Text::deleteEmptyParagraphMechanism(pit_type first, pit_type last, bool tra
                        continue;
 
                if (par.empty() || (par.size() == 1 && par.isLineSeparator(0))) {
-                       pars_.erase(next(pars_.begin(), pit));
+                       pars_.erase(lyx::next(pars_.begin(), pit));
                        --pit;
                        --last;
                        continue;