mirror of
https://github.com/transmission/transmission
synced 2025-02-19 04:41:11 +00:00
(trunk web) selecting the up arrow when no transfers are selected selects the bottom transfer; eliminate an error when pushing the up/down arrow keys with a blank torrent list
This commit is contained in:
parent
246df2b3e7
commit
50c03d585d
1 changed files with 17 additions and 9 deletions
|
@ -481,23 +481,31 @@ Transmission.prototype =
|
|||
keyDown: function(ev)
|
||||
{
|
||||
var handled = false,
|
||||
rows = this._rows,
|
||||
up = ev.keyCode === 38; // up key pressed
|
||||
dn = ev.keyCode === 40, // down key pressed
|
||||
shift = ev.keyCode === 16; // shift key pressed
|
||||
|
||||
if (up || dn)
|
||||
if ((up || dn) && rows.length)
|
||||
{
|
||||
var rows = this._rows,
|
||||
last = this.indexOfLastTorrent(),
|
||||
var last = this.indexOfLastTorrent(),
|
||||
i = last,
|
||||
anchor = this._shift_index;
|
||||
|
||||
if (i === -1) // no selection yet
|
||||
i = 0;
|
||||
else if (dn)
|
||||
i = (i+1) % rows.length;
|
||||
else if (up)
|
||||
i = (i || rows.length) - 1;
|
||||
if (dn)
|
||||
{
|
||||
if (i === -1) // no selection yet
|
||||
i = 0;
|
||||
else
|
||||
i = (i+1) % rows.length;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i === -1) // no selection yet
|
||||
i = rows.length - 1;
|
||||
else
|
||||
i = (i || rows.length) - 1;
|
||||
}
|
||||
var r = rows[i];
|
||||
|
||||
if (anchor >= 0)
|
||||
|
|
Loading…
Reference in a new issue