]> git.lyx.org Git - lyx.git/blobdiff - src/text2.C
delete unused variables.
[lyx.git] / src / text2.C
index 554088df22e90ad9053d98e9b69979b6459d5e38..c41a9c4c1eaae7f4e9f5ccae58cf7757fa526d7c 100644 (file)
@@ -671,7 +671,7 @@ bool LyXText::setCursor(LCursor & cur, pit_type par, pos_type pos,
 {
        LCursor old = cur;
        setCursorIntern(cur, par, pos, setfont, boundary);
-       return deleteEmptyParagraphMechanism(cur, old);
+       return cur.bv().checkDepm(cur, old);
 }
 
 
@@ -759,7 +759,6 @@ pos_type LyXText::getColumnNearX(BufferView const & bv, int right_margin,
        TextMetrics const & tm = bv.textMetrics(this);
        int const xo = bv.coordCache().get(this, pit).x_;
        x -= xo;
-       int max_witdh = tm.maxWidth(); 
        RowMetrics const r = tm.computeRowMetrics(pit, row);
        Paragraph const & par = pars_[pit];
 
@@ -910,7 +909,6 @@ pit_type LyXText::getPitNearY(BufferView & bv, int y)
 
        TextMetrics & tm = bv.textMetrics(this);
        ParagraphMetrics const & pm = tm.parMetrics(it->first);
-       int max_width = tm.maxWidth();
 
        // If we are off-screen (before the visible part)
        if (y < 0
@@ -972,7 +970,6 @@ pit_type LyXText::getPitNearY(BufferView & bv, int y)
 
 Row const & LyXText::getRowNearY(BufferView const & bv, int y, pit_type pit) const
 {
-       Paragraph const & par = pars_[pit];
        ParagraphMetrics const & pm = bv.parMetrics(this, pit);
 
        int yy = bv.coordCache().get(this, pit).y_ - pm.ascent();
@@ -1002,7 +999,6 @@ InsetBase * LyXText::editXY(LCursor & cur, int x, int y)
 
        TextMetrics const & tm = cur.bv().textMetrics(this);
        ParagraphMetrics const & pm = tm.parMetrics(pit);
-       Buffer const & buffer = cur.buffer();
        int right_margin = tm.rightMargin(pm);
        int xx = x; // is modified by getColumnNearX
        pos_type const pos = row.pos()
@@ -1070,13 +1066,15 @@ bool LyXText::cursorLeft(LCursor & cur)
                return setCursor(cur, cur.pit(), cur.pos(), true, true);
        }
        if (cur.pos() != 0) {
-               bool boundary = cur.boundary();
                bool updateNeeded = setCursor(cur, cur.pit(), cur.pos() - 1, true, false);
                if (!checkAndActivateInset(cur, false)) {
+                       /** FIXME: What's this cause purpose???
+                       bool boundary = cur.boundary();
                        if (false && !boundary &&
                            bidi.isBoundary(cur.buffer(), cur.paragraph(), cur.pos() + 1))
                                updateNeeded |=
                                        setCursor(cur, cur.pit(), cur.pos() + 1, true, true);
+                       */
                }
                return updateNeeded;
        }
@@ -1126,7 +1124,6 @@ bool LyXText::cursorUp(LCursor & cur)
        // Tell BufferView to test for FitCursor in any case!
        cur.updateFlags(Update::FitCursor);
 
-       Paragraph const & par = cur.paragraph();
        ParagraphMetrics const & pm = cur.bv().parMetrics(this, cur.pit());
 
        int row;
@@ -1154,7 +1151,7 @@ bool LyXText::cursorUp(LCursor & cur)
                if (dummy == old)
                        ++dummy.pos();
 
-               return deleteEmptyParagraphMechanism(dummy, old);
+               cur.bv().checkDepm(dummy, old);
        }
 
        bool updateNeeded = false;
@@ -1181,7 +1178,6 @@ bool LyXText::cursorDown(LCursor & cur)
        // Tell BufferView to test for FitCursor in any case!
        cur.updateFlags(Update::FitCursor);
 
-       Paragraph const & par = cur.paragraph();
        ParagraphMetrics const & pm = cur.bv().parMetrics(this, cur.pit());
 
        int row;
@@ -1207,14 +1203,14 @@ bool LyXText::cursorDown(LCursor & cur)
                LCursor dummy = cur;
                if (dummy == old)
                        ++dummy.pos();
-
-               bool const changed = deleteEmptyParagraphMechanism(dummy, old);
+               
+               bool const changed = cur.bv().checkDepm(dummy, old);
 
                // Make sure that cur gets back whatever happened to dummy(Lgb)
                if (changed)
                        cur = dummy;
 
-               return changed;
+               return false;
        }
 
        bool updateNeeded = false;
@@ -1276,12 +1272,9 @@ void LyXText::fixCursorAfterDelete(CursorSlice & cur, CursorSlice const & where)
 }
 
 
-bool LyXText::deleteEmptyParagraphMechanism(LCursor & cur, LCursor & old)
+bool LyXText::deleteEmptyParagraphMechanism(LCursor & cur,
+               LCursor & old, bool & need_anchor_change)
 {
-       // Would be wrong to delete anything if we have a selection.
-       if (cur.selection())
-               return false;
-
        //lyxerr[Debug::DEBUG] << "DEPM: cur:\n" << cur << "old:\n" << old << endl;
        // old should point to us
        BOOST_ASSERT(old.text() == this);
@@ -1322,8 +1315,6 @@ bool LyXText::deleteEmptyParagraphMechanism(LCursor & cur, LCursor & old)
                    && oldpar.isLineSeparator(old.pos() - 1)
                    && !oldpar.isDeleted(old.pos() - 1)) {
                        oldpar.eraseChar(old.pos() - 1, false); // do not track changes in DEPM
-                       TextMetrics & tm = cur.bv().textMetrics(this);
-                       tm.redoParagraph(old.pit());
 #ifdef WITH_WARNINGS
 #warning This will not work anymore when we have multiple views of the same buffer
 // In this case, we will have to correct also the cursors held by
@@ -1333,7 +1324,7 @@ bool LyXText::deleteEmptyParagraphMechanism(LCursor & cur, LCursor & old)
                        // correct all cursor parts
                        if (same_par) {
                                fixCursorAfterDelete(cur.top(), old.top());
-                               cur.resetAnchor();
+                               need_anchor_change = true;
                        }
                        return true;
                }
@@ -1370,19 +1361,14 @@ bool LyXText::deleteEmptyParagraphMechanism(LCursor & cur, LCursor & old)
                                // their address has changed. Therefore we
                                // need to `regenerate' cur. (JMarc)
                                cur.updateInsets(&(cur.bottom().inset()));
-                               cur.resetAnchor();
+                               need_anchor_change = true;
                        }
                }
-               // There is a crash reported by Edwin Leuven (16/04/2006) because of:
-               //ParIterator par_it(old);
-               //updateLabels(old.buffer(), par_it);
-               // So for now we do the full update:
-               updateLabels(old.buffer());
                return true;
        }
 
        if (oldpar.stripLeadingSpaces())
-               cur.resetAnchor();
+               need_anchor_change = true;
 
        return false;
 }