]> git.lyx.org Git - lyx.git/blobdiff - src/paragraph.C
bug 2298: cursorTop/Bottom/Home/End does not redraw after dEPM
[lyx.git] / src / paragraph.C
index 8f136352fe39d09bee51dee4eb5dbc1f14f06abf..6060876d9fc62aa759cd58de7104515d26db8933 100644 (file)
@@ -159,12 +159,15 @@ void Paragraph::write(Buffer const & buf, ostream & os,
        lyx::time_type const curtime(lyx::current_time());
 
        int column = 0;
-       for (pos_type i = 0; i < size(); ++i) {
+       for (pos_type i = 0; i <= size(); ++i) {
 
                Change change = pimpl_->lookupChangeFull(i);
                Changes::lyxMarkChange(os, column, curtime, running_change, change);
                running_change = change;
 
+               if (i == size())
+                       break;
+
                // Write font changes
                LyXFont font2 = getFontSettings(bparams, i);
                if (font2 != font1) {
@@ -223,15 +226,6 @@ void Paragraph::write(Buffer const & buf, ostream & os,
                }
        }
 
-       // to make reading work properly
-       if (!size()) {
-               running_change = pimpl_->lookupChange(0);
-               Changes::lyxMarkChange(os, column, curtime,
-                       Change(Change::UNCHANGED), running_change);
-       }
-       Changes::lyxMarkChange(os, column, curtime,
-               running_change, Change(Change::UNCHANGED));
-
        os << "\n\\end_layout\n";
 }
 
@@ -570,8 +564,6 @@ int Paragraph::stripLeadingSpaces()
 
        int i = 0;
        while (!empty() && (isNewline(0) || isLineSeparator(0))) {
-               // Set Change::Type to Change::INSERTED to quietly remove it
-               setChange(0, Change::INSERTED);
                erase(0);
                ++i;
        }
@@ -1639,14 +1631,14 @@ void Paragraph::cleanChanges()
 
 Change::Type Paragraph::lookupChange(lyx::pos_type pos) const
 {
-       BOOST_ASSERT(empty() || pos < size());
+       BOOST_ASSERT(pos <= size());
        return pimpl_->lookupChange(pos);
 }
 
 
 Change const Paragraph::lookupChangeFull(lyx::pos_type pos) const
 {
-       BOOST_ASSERT(empty() || pos < size());
+       BOOST_ASSERT(pos <= size());
        return pimpl_->lookupChangeFull(pos);
 }
 
@@ -1669,6 +1661,12 @@ void Paragraph::setChange(lyx::pos_type pos, Change::Type type)
 }
 
 
+void Paragraph::setChangeFull(lyx::pos_type pos, Change change)
+{
+       pimpl_->setChangeFull(pos, change);
+}
+
+
 void Paragraph::markErased(bool erased)
 {
        pimpl_->markErased(erased);