mirror of
https://github.com/transmission/transmission.git
synced 2026-04-26 03:40:22 +01: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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user