Fix for Javascript error to center selected diff chunk by pressing "Enter" -- added "c" as a supplemental hotkey

Review Request #1507 — Created April 5, 2010 and submitted — Latest diff uploaded


Review Board


The following error is reported in 1.5 Beta 1 or 2 when selecting a diff chunk and pressing "enter":

function scrollToAnchor(anchor, noscroll) {
    if (anchor.length == 0) {
        return false;
    if (anchor.parent().is(":hidden")) {
Uncaught TypeError: Object  has no method 'parent'
        return false;
The fix is to make a call to jQuery before calling scrollToAnchor.

In addition, as I'm right handed, I found it inconvenient to select a chunk using the mouse in my right hand, and then having to press "enter".  I'm proposing to add another key, "c" for center, as it is not used already.  
Verified on Windows for Chrome, Firefox and IE.  Both "c" and "enter" behave as expected (re-centered the selected diff chunk).