Fix problems with moving selection caused by deluge-console emptying selection when only one element is selected
This commit is contained in:
parent
2373eda462
commit
471757d6c6
|
@ -86,7 +86,10 @@ def torrent_action(idx, data, mode, ids):
|
||||||
if tq in mode.marked:
|
if tq in mode.marked:
|
||||||
selected_num += 1
|
selected_num += 1
|
||||||
if qact == ACTION.QUEUE_TOP:
|
if qact == ACTION.QUEUE_TOP:
|
||||||
|
if mode.marked:
|
||||||
mode.cursel = 1 + sorted(mode.marked).index(mode.cursel)
|
mode.cursel = 1 + sorted(mode.marked).index(mode.cursel)
|
||||||
|
else:
|
||||||
|
mode.cursel = 1
|
||||||
mode.marked = range(1, selected_num + 1)
|
mode.marked = range(1, selected_num + 1)
|
||||||
elif qact == ACTION.QUEUE_UP:
|
elif qact == ACTION.QUEUE_UP:
|
||||||
mode.cursel = max(1, mode.cursel - 1)
|
mode.cursel = max(1, mode.cursel - 1)
|
||||||
|
@ -97,7 +100,10 @@ def torrent_action(idx, data, mode, ids):
|
||||||
mode.marked = map(lambda v: v+1, mode.marked)
|
mode.marked = map(lambda v: v+1, mode.marked)
|
||||||
mode.marked = filter(lambda v: v<=queue_length, mode.marked)
|
mode.marked = filter(lambda v: v<=queue_length, mode.marked)
|
||||||
elif qact == ACTION.QUEUE_BOTTOM:
|
elif qact == ACTION.QUEUE_BOTTOM:
|
||||||
|
if mode.marked:
|
||||||
mode.cursel = queue_length - selected_num + 1 + sorted(mode.marked).index(mode.cursel)
|
mode.cursel = queue_length - selected_num + 1 + sorted(mode.marked).index(mode.cursel)
|
||||||
|
else:
|
||||||
|
mode.cursel = queue_length
|
||||||
mode.marked = range(queue_length - selected_num + 1, queue_length+1)
|
mode.marked = range(queue_length - selected_num + 1, queue_length+1)
|
||||||
|
|
||||||
if qact == ACTION.QUEUE_TOP:
|
if qact == ACTION.QUEUE_TOP:
|
||||||
|
|
Loading…
Reference in New Issue