Comments on patch for paragraph-move-down to move sub-items as well

Scott Kostyshak skostysh at lyx.org
Mon Feb 3 01:36:53 UTC 2020


On Sun, Feb 02, 2020 at 07:08:50PM -0500, Richard Kimberly Heck wrote:
> On 2/1/20 12:40 PM, Scott Kostyshak wrote:
> > I've been working on a patch for LFUN_PARAGRAPH_MOVE_DOWN move subitems
> > of an item along with the item. For example, consider the following
> > situation:
> >
> >   1. One item <cur>
> >      a. "subitem"
> >   2. Another item
> >
> > Currently (i.e., without the patch), if the cursor is at positiion <cur>
> > and the user executes a paragraph-move-down, we get the following:
> >
> >   1. "subitem"
> >   2. One item <cur>
> >   3. Another item
> >
> > With the patch, the user would get the following:
> >
> >   1. Another item
> >   2. One item <cur>
> >      a. "subitem"
> >
> > I believe this functionality would be consistent with the current
> > behavior of outline-down (which has the same keybinding as
> > paragraph-move-down), e.g., subsections are moved with sections.
> >
> > Does anyone have comments on the patch, either the desired functionality
> > or the actual code?
> 
> I have found the existing functionality annoying at time, so I do think
> your approach is better. I didn't see anything in the patch. The logic
> seems very complex!

It was more complex than I had thought it would be. I don't see how the
logic in Text3.cpp can be simplified. At least, I looked for similar
code to reuse. environment-split does something similar, but I didn't
see much opportunity. The logic in RandomAccessList is overly
complicated (and inefficient) and I'm working on simplifying it by using
a splice instead of all of those swaps.

> I assume one would also want to do the same thing for paragraph-move-up?

Yes.

> If so, then probably you can extract a lot of common code here.

Makes sense, I'll work on that.

Thanks for taking a look, Riki.

Scott
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20200202/0f835e39/attachment.asc>


More information about the lyx-devel mailing list