]> git.lyx.org Git - lyx.git/blobdiff - src/text2.C
bug 2298: cursorTop/Bottom/Home/End does not redraw after dEPM
[lyx.git] / src / text2.C
index 286a31ccf195936b17f11733562a3fb2fb2e08c5..42ee4e5358a13366ea557c4e447c9b04e8320f62 100644 (file)
@@ -207,7 +207,7 @@ LyXFont LyXText::getFont(Paragraph const & par, pos_type const pos) const
                font.realize(outerFont(pit, pars_));
 
        // Realize with the fonts of lesser depth.
-       font.realize(defaultfont_);
+       font.realize(params.getFont());
 
        return font;
 }
@@ -221,7 +221,7 @@ LyXFont LyXText::getFont(Paragraph const & par, pos_type const pos) const
 // font.
 void LyXText::applyOuterFont(LyXFont & font) const {
        LyXFont lf(font_);
-       lf.reduce(defaultfont_);
+       lf.reduce(bv()->buffer()->params().getFont());
        lf.realize(font);
        lf.setLanguage(font.language());
        font = lf;
@@ -238,7 +238,7 @@ LyXFont LyXText::getLayoutFont(pit_type const pit) const
        LyXFont font = layout->font;
        // Realize with the fonts of lesser depth.
        //font.realize(outerFont(pit, paragraphs()));
-       font.realize(defaultfont_);
+       font.realize(bv()->buffer()->params().getFont());
 
        return font;
 }
@@ -253,7 +253,7 @@ LyXFont LyXText::getLabelFont(Paragraph const & par) const
 
        LyXFont font = layout->labelfont;
        // Realize with the fonts of lesser depth.
-       font.realize(defaultfont_);
+       font.realize(bv()->buffer()->params().getFont());
 
        return font;
 }
@@ -289,7 +289,7 @@ void LyXText::setCharFont(pit_type pit, pos_type pos, LyXFont const & fnt)
        if (!isMainText())
                layoutfont.realize(font_);
 
-       layoutfont.realize(defaultfont_);
+       layoutfont.realize(bv()->buffer()->params().getFont());
 
        // Now, reduce font against full layout font
        font.reduce(layoutfont);
@@ -476,16 +476,16 @@ void LyXText::setFont(LCursor & cur, LyXFont const & font, bool toggleall)
 // the cursor set functions have a special mechanism. When they
 // realize you left an empty paragraph, they will delete it.
 
-void LyXText::cursorHome(LCursor & cur)
+bool LyXText::cursorHome(LCursor & cur)
 {
        BOOST_ASSERT(this == cur.text());
        Row const & row = cur.paragraph().getRow(cur.pos(),cur.boundary());
 
-       setCursor(cur, cur.pit(), row.pos());
+       return setCursor(cur, cur.pit(), row.pos());
 }
 
 
-void LyXText::cursorEnd(LCursor & cur)
+bool LyXText::cursorEnd(LCursor & cur)
 {
        BOOST_ASSERT(this == cur.text());
        // if not on the last row of the par, put the cursor before
@@ -494,7 +494,7 @@ void LyXText::cursorEnd(LCursor & cur)
        pos_type end = cur.textRow().endpos();
        if (end == 0)
                // empty text, end-1 is no valid position
-               return;
+               return false;
        bool boundary = false;
        if (end != cur.lastpos()) {
                if (!cur.paragraph().isLineSeparator(end-1)
@@ -503,21 +503,21 @@ void LyXText::cursorEnd(LCursor & cur)
                else
                        --end;
        }
-       setCursor(cur, cur.pit(), end, true, boundary);
+       return setCursor(cur, cur.pit(), end, true, boundary);
 }
 
 
-void LyXText::cursorTop(LCursor & cur)
+bool LyXText::cursorTop(LCursor & cur)
 {
        BOOST_ASSERT(this == cur.text());
-       setCursor(cur, 0, 0);
+       return setCursor(cur, 0, 0);
 }
 
 
-void LyXText::cursorBottom(LCursor & cur)
+bool LyXText::cursorBottom(LCursor & cur)
 {
        BOOST_ASSERT(this == cur.text());
-       setCursor(cur, cur.lastpit(), boost::prior(paragraphs().end())->size());
+       return setCursor(cur, cur.lastpit(), boost::prior(paragraphs().end())->size());
 }
 
 
@@ -1255,7 +1255,7 @@ bool LyXText::deleteEmptyParagraphMechanism(LCursor & cur, LCursor & old)
        if (oldpar.empty() || (oldpar.size() == 1 && oldpar.isLineSeparator(0))) {
                // Delete old par.
                recordUndo(old, Undo::ATOMIC,
-                          max(old.pit() - 1, 0),
+                          max(old.pit() - 1, pit_type(0)),
                           min(old.pit() + 1, old.lastpit()));
                ParagraphList & plist = old.text()->paragraphs();
                plist.erase(plist.begin() + old.pit());