Skip to content
Permalink
Browse files
2011-02-17 Ojan Vafai <ojan@chromium.org>
        Reviewed by Adam Barth.

        use shift+j/k to focus next/previous line
        https://bugs.webkit.org/show_bug.cgi?id=54723

        Tested on a large Hyatt change to confirm it performed fine.
        (https://bugs.webkit.org/attachment.cgi?id=82533&action=review)

        * code-review.js:

Canonical link: https://commits.webkit.org/69098@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@79166 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
ojanvafai committed Feb 21, 2011
1 parent 925c1c5 commit 1198692d015f94dfb8d660c2a3e7c017a8152887
Showing 3 changed files with 28 additions and 2 deletions.
@@ -1,3 +1,15 @@
2011-02-17 Ojan Vafai <ojan@chromium.org>

Reviewed by Adam Barth.

use shift+j/k to focus next/previous line
https://bugs.webkit.org/show_bug.cgi?id=54723

Tested on a large Hyatt change to confirm it performed fine.
(https://bugs.webkit.org/attachment.cgi?id=82533&action=review)

* code-review.js:

2011-02-17 Ojan Vafai <ojan@chromium.org>

Reviewed by Adam Barth.
@@ -447,7 +447,7 @@ def self.linkifyFilename(filename)
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="code-review.js?version=35"></script>
<script src="code-review.js?version=36"></script>
EOF

def self.revisionOrDescription(string)
@@ -1349,7 +1349,7 @@ var CODE_REVIEW_UNITTEST;
}

function focusNext(filter, direction) {
var focusable_nodes = $('a,.frozenComment,.previousComment,.DiffBlock,.overallComments').filter(function() {
var focusable_nodes = $('a,.Line,.frozenComment,.previousComment,.DiffBlock,.overallComments').filter(function() {
return !$(this).hasClass('DiffBlock') || $('.add,.remove', this).size();
});

@@ -1376,6 +1376,8 @@ var CODE_REVIEW_UNITTEST;
var kCharCodeForP = 'p'.charCodeAt(0);
var kCharCodeForJ = 'j'.charCodeAt(0);
var kCharCodeForK = 'k'.charCodeAt(0);
var kCharCodeForCapitalJ = 'J'.charCodeAt(0);
var kCharCodeForCapitalK = 'K'.charCodeAt(0);
var kCharCodeForEnter = '\r'.charCodeAt(0);

function isComment(node) {
@@ -1385,6 +1387,10 @@ var CODE_REVIEW_UNITTEST;
function isDiffBlock(node) {
return node.hasClass('DiffBlock');
}

function isLine(node) {
return node.hasClass('Line');
}

$('textarea').live('keydown', function(e) {
var escape_key_code = 27;
@@ -1416,6 +1422,14 @@ var CODE_REVIEW_UNITTEST;
case kCharCodeForK:
handled = focusNext(isDiffBlock, DIRECTION.BACKWARD);
break;

case kCharCodeForCapitalJ:
handled = focusNext(isLine, DIRECTION.FORWARD);
break;

case kCharCodeForCapitalK:
handled = focusNext(isLine, DIRECTION.BACKWARD);
break;

case kCharCodeForEnter:
handled = handleEnterKeyPress();

0 comments on commit 1198692

Please sign in to comment.