]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insettext.C
Insert mouse_x/y positon to have a REAL motion check. Fixed the spurious
[lyx.git] / src / insets / insettext.C
index d4ed590e852380580f8d7880ec3f32a1ee916a30..4133732325f9ee46ee023724806c3002dfd269bf 100644 (file)
@@ -839,6 +839,8 @@ bool InsetText::updateInsetInInset(BufferView * bv, Inset * inset)
 {
        if (!autoBreakRows && par->next())
                collapseParagraphs(bv->buffer()->params);
+       if (inset == this)
+               return true;
        bool clear = false;
        if (!lt) {
                lt = getLyXText(bv);
@@ -878,6 +880,10 @@ void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button)
 {
        no_selection = true;
 
+       // use this to check mouse motion for selection!
+       mouse_x = x;
+       mouse_y = y;
+
        int tmp_x = x - drawTextXOffset;
        int tmp_y = y + insetAscent - getLyXText(bv)->first;
        Inset * inset = bv->checkInsetHit(getLyXText(bv), tmp_x, tmp_y);
@@ -1006,7 +1012,7 @@ bool InsetText::insetButtonRelease(BufferView * bv, int x, int y, int button)
 
 void InsetText::insetMotionNotify(BufferView * bv, int x, int y, int state)
 {
-       if (no_selection)
+       if (no_selection || ((mouse_x == x) && (mouse_y == y)))
                return;
        if (the_locking_inset) {
                the_locking_inset->insetMotionNotify(bv, x - inset_x,
@@ -2185,8 +2191,14 @@ void InsetText::resizeLyXText(BufferView * bv, bool force) const
        }
        do_resize = 0;
 //     lyxerr << "InsetText::resizeLyXText\n";
-       if (!par->next() && !par->size()) // no data, resize not neccessary!
+       if (!par->next() && !par->size()) { // no data, resize not neccessary!
+               // we have to do this as a fixed width may have changed!
+               LyXText * t = getLyXText(bv);
+               saveLyXTextState(t);
+               t->init(bv, true);
+               restoreLyXTextState(bv, t);
                return;
+       }
        // one endless line, resize normally not necessary
        if (!force && getMaxWidth(bv, this) < 0)
                return;
@@ -2585,6 +2597,8 @@ bool InsetText::checkInsertChar(LyXFont & font)
 void InsetText::collapseParagraphs(BufferParams const & bparams) const
 {
        while(par->next()) {
+               if (!par->isSeparator(par->size()-1))
+                       par->insertChar(par->size()-1, ' ');
                par->pasteParagraph(bparams);
        }
        reinitLyXText();