Page 1 of 1

how move items up / down a list?

Posted: 2017-05-12 03:40:54
by ronald
Hello,
How does one move items up and down (and if possible left and right) in a list?
How do I configure the corresponding shortcuts ?
thanks very much !!

Re: how move items up / down a list?

Posted: 2017-05-12 14:58:23
by adryan
G’day, Ronald et al

Moving list items to the left or right (ie, decreasing or increasing the list level of an item) can be accomplished in various ways. Here are some of them:–

(1) Place the cursor anywhere in the item in question, then use Cmd+Option+right_arrow (⌘⌥→) to move the item to the right, or Cmd+Option+left_arrow (⌘⌥←) to move the item to the left.
(2) Place the cursor at the beginning of the item in question, then hit the Tab key to move the item to the right, or Shift-Tab to move it to the left.
(3) Place the cursor anywhere in the item in question, then choose from the main menu: Format > Increase [or Decrease] Indent. You will notice here that Nisus Writer already provides shortcuts for these commands, as used in Method 1 above.
(4) Place the cursor anywhere in the item in question, then choose from the drop-down menu in the List Toolbar Item: Increase [or Decrease] Indent.
(5) Place the cursor anywhere in the item in question, then increase or decrease the level in the Lists Palette from the Palette Library.

Moving list items up or down is something you need to do manually by cutting and pasting the relevant paragraph(s) into the required position in the list. If it’s an ordered list, Nisus Writer takes care of the ordering (eg, numbering) automatically. One could write macros to shift items up or down, and perhaps assign shortcuts to these macros, but you’d probably want them to shift all the nested items as well.

Cheers,
Adrian

Re: how move items up / down a list?

Posted: 2018-04-06 00:50:59
by Axbax
Hi, does anyone know of a macro that can do this? Or could the developers implement this function? I use it a lot when I write in Scrivener/Ulysses/Bear/Word, so I'd love to see it implemented in Nisus as well.
Cheers

Re: how move items up / down a list?

Posted: 2018-04-06 07:40:02
by phspaelti
The following macro will move a list item down one. It will keep the item selected, so you can use it repeatedly to move down two or three. It can't handle multiple items.

Re: how move items up / down a list?

Posted: 2018-04-06 10:02:39
by Axbax
This works very well. Thanks! But could you (or someone else) perhaps make one that moves up as well? (I tried, but I am not experienced with coding).

Re: how move items up / down a list?

Posted: 2018-04-06 18:48:15
by phspaelti
I improved the logic of the macro. So now I'm able to provide both a "Move Up" and a "Move Down". As before the macros only apply to one list item (along with all its child items) at a time. I considered the possibility of moving multiple items at once. But the problem is that there is too much potential for the user to make "bad" selections (e.g. having a selection start in one list and cross over non-list text and end in another list), and then having to resolve all such limit cases is more work than I am prepared to invest in this problem at this time. So while the macro preserves the whole selection, it only considers the list item at the starting point of the selection. Best usage is to place the cursor in/on the list item you want to move.

If the selection is in the last item of a (sub-)list "Move Down" will silently terminate and do nothing. And vice versa for "Move Up".

Re: how move items up / down a list?

Posted: 2018-04-07 06:59:40
by Axbax
You are a star! This works like a charm and will be so helpful for my writing. Thanks!!

If you (or someone else out there) could make a similar macro to move table rows up and down, I'd be very thankful.

Re: how move items up / down a list?

Posted: 2018-04-07 19:08:46
by phspaelti
Moving table rows is a much easier problem. This macro will work for multiple selected rows too.

Re: how move items up / down a list?

Posted: 2019-02-20 14:44:32
by Axbax
Hi,
The list macros above have not worked well since the update to NWP 3. Could someone help and update the macro?
Cheers

Re: how move items up / down a list?

Posted: 2019-02-20 17:57:12
by phspaelti
Hi. In what way has it not worked well? I'm not aware of anything having changed in NWP 3.0 that would affect the functioning. So if you could let me know how the outcome of the macro is different from what you expect…

Re: how move items up / down a list?

Posted: 2019-02-21 04:05:59
by Axbax
Thanks for the quick response. I tested it again now - and of course it worked fine :D I have had some issues with menu keys / shortcuts in NWP since the update and I suspect that this may be the reason that the macro hasn't always worked as expected. The macro in itself seems to work well as I tested it now. Thanks!

Re: how move items up / down a list?

Posted: 2019-02-27 19:05:42
by writerhoward
I have a numbered list in NW3 with 25 items. I wanted to move #24 to #21. When I moved #24 up to #23 and then up to #22 it worked fine. But when I moved it up from #22 to #21, the macro changed the number of 21 to 1, so that the list then read this way:

19.
20.

1.
22.
23.
24.
25.

For your information, before I used the macro the list I had to restart the list at #21 because there were two non-list line between #20 and #21.

Can the macro be easily modified to accommodate my situation?

Howard

Re: how move items up / down a list?

Posted: 2019-02-28 00:18:39
by phspaelti
Hello Howard,
I take it you understand why this happens. Your item "21" has a restart on it which is some kind of invisible "memo" on the list item itself. Unfortunately the only way to know this is to look in the "Format:Lists" submenu, where the name of the first item changes from "Restart Numbering" to "Continue Numbering From Previous". And inside a macro the menus are not updated, so this can't even be checked. This is a bit of bummer, and frankly I think the set of list item commands in the macro language should be augmented to make this easier.

But here's another question: Why are you restarting the list at all? If you want to continue the list across intervening non-list content you should use the "Continue numbering across document content" feature in the style definition (in the style sheet).
Screen Shot 2019-02-28 at 17.16.47.png
Screen Shot 2019-02-28 at 17.16.47.png (53.57 KiB) Viewed 4062 times