rtfeldman/selectlist

A function for moving selection?

Opened this issue · 6 comments

I think it would be useful to have a function that allows moving the selection. Something like:

SelectList.fromLists [ 1, 2 ] 3 [ 4, 5, 6 ]
    |> SelectList.move 2

== SelectList.fromLists [ 1, 2, 3, 4] 5 [ 6 ]


SelectList.fromLists [ 1, 2 ] 3 [ 4, 5, 6 ]
    |> SelectList.move -10

== SelectList.fromLists [] 1 [ 2, 3, 4, 5, 6 ]

I could make a pull request, but wanted to discuss this first.

I understand that the select function can be used for achieving something similar. But it would require adding a unique index to the elements first.

This is a really useful library and looks like a few other people this feature too, maybe you could make that pull request? ;)

Hi, I really needed the move function and since the issue has been here for a while I decided to make the pull request. let me know what you guys think.

@GAumala I recently published a selectlist-extra package with some of the selectList helper functions I have been using. My implementation of moving through a list is a bit different than yours, so I would be interested to hear what you think about it.
@rtfeldman what are your thoughts about adding this functionality to the core selectlist package?

@johnathanbostrom I've actually ended up refactored selectlist out of the only project where I was using it, so I have a counter-proposal: would you like to publish a standalone replacement (perhaps a fork) and have me update the README of this repo to suggest your package as a replacement? 😄

@rtfeldman sounds good. I went ahead and forked your repo and published my fork here. I plan to add this feature and few others this weekend.
Out of curiosity what direction did you decide to go when you moved away from the selectlist?

@johnathanbostrom have you added the move functions into your fork?