On Wed, Apr 12, 2006 at 10:50:12PM +0200, Edwin Leuven wrote: > Georg Baum wrote: > >Did you see Andrés message about the anchor and cursor depth? I think he > >is right with his concern, and you should only act on single paragraphs. > > as abdel wrote, i intend to move the full paragraphs, not the selection
I understood that. > however, moving the anchor around is indeed a problem when it is in math > or footnotes etc I am not surprised. > it turns out that cur.anchor_.pit() then returns a 0 and not the pit of > its parent Why should it return the pit of a parent instead of its own? In math, all cells have excatly one 'paragraph', so pit (i.e. the number of the paragraph in the cell's paragraph list) tends to be 0. > is this the way it should be? Yes. > PS the single par moving around patch is attached > > an alternative would be to disable the moving around when cur.pit() = 0 > and cur.anchor_.pit() = 0 Just disable it when the selection is active. It doesn't buy us anything if we implement a half-working solution. > this would imply that we cannot move the 1st par or ranges that include > it, but we can move ranges where the cursor and anchor are in a regular > paragraph > > Index: src/LyXAction.C > =================================================================== > --- src/LyXAction.C (revision 13657) > +++ src/LyXAction.C (working copy) > @@ -353,6 +353,8 @@ > { LFUN_MOUSE_RELEASE, "", ReadOnly }, > { LFUN_MOUSE_DOUBLE, "", ReadOnly }, > { LFUN_MOUSE_TRIPLE, "", ReadOnly }, > + { LFUN_PARAGRAPH_MOVE_DOWN, "paragraph-move-down", Noop }, > + { LFUN_PARAGRAPH_MOVE_UP, "paragraph-move-up", Noop }, > { LFUN_NOACTION, "", Noop } > }; This list used ton be ordered alphabetically. > Index: src/lyxfunc.C > =================================================================== > --- src/lyxfunc.C (revision 13657) > +++ src/lyxfunc.C (working copy) > @@ -561,6 +561,18 @@ > flag = getStatus(func); > } > > + case LFUN_PARAGRAPH_MOVE_UP: { > + if (cur) > + enable = cur.pit() > 0 && !cur.selection(); > + break; > + } Why is the 'if (cur)' needed? If you do not want to work in math (and have good reasons for this discrepancy), use cur.inTexted(). Andre'