]> granicus.if.org Git - transmission/commitdiff
(trunk web) #4460 "Weird behavior when using up/down keys" -- fixed.
authorJordan Lee <jordan@transmissionbt.com>
Tue, 30 Aug 2011 02:03:17 +0000 (02:03 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Tue, 30 Aug 2011 02:03:17 +0000 (02:03 +0000)
web/javascript/transmission.js

index 3b686e3d935dda5bc2cb18b4f309fe40f3f88f4f..45d4abd489d177e6b961db0e947660e3d972b45e 100644 (file)
@@ -487,22 +487,16 @@ Transmission.prototype =
                {
                        var last = this.indexOfLastTorrent(),
                            i = last,
-                           anchor = this._shift_index;
+                           anchor = this._shift_index,
+                           r,
+                           min = 0,
+                           max = rows.length - 1;
+
+                       if (dn && (i+1 <= max))
+                               ++i;
+                       else if (up && (i-1 >= min))
+                               --i;
 
-                       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)