On Tue, Apr 05, 2005 at 04:36:24PM +0300, Martin Vermeer wrote:
> 
>     685      cur.pos() = 0; // We've deleted the whole cell. Only pos 0 is 
> valid.
> 
> I think this is too general, though it fixes bug 1654, it shows also up
> when deleting a partial cell as the cursor jumping to the start.
> 
> Patch attached. This still fixes bug 1654 but behaves OK with non-grid 
> cells too (fontinsets, decorations etc.)
> 
> - Martin

> Index: CutAndPaste.C
> ===================================================================
> RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/CutAndPaste.C,v
> retrieving revision 1.149
> diff -u -r1.149 CutAndPaste.C
> --- CutAndPaste.C     25 Feb 2005 11:55:31 -0000      1.149
> +++ CutAndPaste.C     5 Apr 2005 13:33:50 -0000
> @@ -670,6 +670,7 @@
>       CursorSlice const & i1 = cur.selBegin();
>       CursorSlice const & i2 = cur.selEnd();
>       if (i1.inset().asMathInset()) {
> +             cur.top() = i1;
>               if (i1.idx() == i2.idx()) {
>                       i1.cell().erase(i1.pos(), i2.pos());
>               } else {
> @@ -680,9 +681,9 @@
>                       for (InsetBase::row_type row = r1; row <= r2; ++row)
>                               for (InsetBase::col_type col = c1; col <= c2; 
> ++col)
>                                       p->cell(p->index(row, col)).clear();
> +                     // We've deleted the whole cell. Only pos 0 is valid.
> +                     cur.pos() = 0; 
>               }
> -             cur.top() = i1;
> -             cur.pos() = 0; // We've deleted the whole cell. Only pos 0 is 
> valid.
>               cur.resetAnchor();
>       } else {
>               lyxerr << "can't erase this selection 1" << endl;

Most certainly my mistake.

Patch looks sensible.

Andre'

Reply via email to