]> git.lyx.org Git - lyx.git/blobdiff - src/text.C
"Inter-word Space"
[lyx.git] / src / text.C
index b79fb2347599ced4074095c119a330d0ab16a3c1..bc95c353bd216582c69705fcd84df1fce687e817 100644 (file)
@@ -87,16 +87,24 @@ void LyXText::updateRowPositions()
 
 int LyXText::top_y() const
 {
-       if (isInInset() || anchor_row_ == rowlist_.end() )
+       if (anchor_row_ == rowlist_.end())
                return 0;
+
        return anchor_row_->y() + anchor_row_offset_;
 }
 
 
 void LyXText::top_y(int newy)
 {
-       if (rows().empty() || isInInset())
+       if (rows().empty())
+               return;
+
+       if (isInInset()) {
+               anchor_row_ = rows().begin();
+               anchor_row_offset_ = newy;
                return;
+       }
+
        lyxerr[Debug::GUI] << "setting top y = " << newy << endl;
 
        int y = newy;
@@ -137,10 +145,12 @@ int LyXText::workWidth() const
 }
 
 
-int LyXText::workWidth(Inset * inset) const
+int LyXText::workWidth(Inset const * inset) const
 {
-       Paragraph * par = inset->parOwner();
-       lyx::Assert(par);
+       ParagraphList::iterator par = std::find(ownerParagraphs().begin(),
+                                               ownerParagraphs().end(),
+                                               *inset->parOwner());
+       //lyx::Assert(par);
 
        pos_type pos = par->getPositionOfInset(inset);
        lyx::Assert(pos != -1);
@@ -1457,7 +1467,7 @@ void LyXText::breakParagraph(ParagraphList & paragraphs, char keep_layout)
           && !layout->keepempty)
                return;
 
-       setUndo(bv(), Undo::FINISH, cursor.par(), boost::next(cursor.par()));
+       setUndo(bv(), Undo::FINISH, cursor.par());
 
        // Always break behind a space
        //
@@ -1562,7 +1572,7 @@ void LyXText::redoParagraph()
 // same Paragraph one to the right and make a rebreak
 void LyXText::insertChar(char c)
 {
-       setUndo(bv(), Undo::INSERT, cursor.par(), boost::next(cursor.par()));
+       setUndo(bv(), Undo::INSERT, cursor.par());
 
        // When the free-spacing option is set for the current layout,
        // disable the double-space checking
@@ -2112,7 +2122,7 @@ void LyXText::acceptChange()
        if (selection.start.par() == selection.end.par()) {
                LyXCursor & startc = selection.start;
                LyXCursor & endc = selection.end;
-               setUndo(bv(), Undo::INSERT, startc.par(), boost::next(startc.par()));
+               setUndo(bv(), Undo::INSERT, startc.par());
                startc.par()->acceptChange(startc.pos(), endc.pos());
                finishUndo();
                clearSelection();
@@ -2131,8 +2141,7 @@ void LyXText::rejectChange()
        if (selection.start.par() == selection.end.par()) {
                LyXCursor & startc = selection.start;
                LyXCursor & endc = selection.end;
-               setUndo(bv(), Undo::INSERT, startc.par(),
-                       boost::next(startc.par()));
+               setUndo(bv(), Undo::INSERT, startc.par());
                startc.par()->rejectChange(startc.pos(), endc.pos());
                finishUndo();
                clearSelection();
@@ -2349,7 +2358,7 @@ void LyXText::changeCase(LyXText::TextCase action)
 
        lyx::Assert(from <= to);
 
-       setUndo(bv(), Undo::FINISH, from.par(), boost::next(to.par()));
+       setUndo(bv(), Undo::FINISH, from.par(), to.par());
 
        pos_type pos = from.pos();
        ParagraphList::iterator pit = from.par();
@@ -2419,8 +2428,7 @@ void LyXText::Delete()
                LyXCursor tmpcursor = cursor;
                // to make sure undo gets the right cursor position
                cursor = old_cursor;
-               setUndo(bv(), Undo::DELETE,
-                       cursor.par(), boost::next(cursor.par()));
+               setUndo(bv(), Undo::DELETE, cursor.par());
                cursor = tmpcursor;
                backspace();
        }
@@ -2479,7 +2487,7 @@ void LyXText::backspace()
                if (cursor.par() != ownerParagraphs().begin()) {
                        setUndo(bv(), Undo::DELETE,
                                boost::prior(cursor.par()),
-                               boost::next(cursor.par()));
+                               cursor.par());
                }
 
                ParagraphList::iterator tmppit = cursor.par();
@@ -2545,8 +2553,7 @@ void LyXText::backspace()
        } else {
                // this is the code for a normal backspace, not pasting
                // any paragraphs
-               setUndo(bv(), Undo::DELETE,
-                       cursor.par(), boost::next(cursor.par()));
+               setUndo(bv(), Undo::DELETE, cursor.par());
                // We used to do cursorLeftIntern() here, but it is
                // not a good idea since it triggers the auto-delete
                // mechanism. So we do a cursorLeftIntern()-lite,