Merge pull request #1615 from Nachtalb/ne/fix-infinite_scroll-with-vim_bindings

Fix not jumping to results loaded by infinite scroll
This commit is contained in:
Markus Heiser 2019-12-24 17:34:33 +01:00 committed by GitHub
commit 5a0a66e9bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -125,6 +125,14 @@ $(document).ready(function() {
}
});
function nextResult(current, direction) {
var next = current[direction]();
while (!next.is('.result') && next.length !== 0) {
next = next[direction]();
}
return next
}
function highlightResult(which) {
return function() {
var current = $('.result[data-vim-selected]');
@ -157,13 +165,13 @@ $(document).ready(function() {
}
break;
case 'down':
next = current.next('.result');
next = nextResult(current, 'next');
if (next.length === 0) {
next = $('.result:first');
}
break;
case 'up':
next = current.prev('.result');
next = nextResult(current, 'prev');
if (next.length === 0) {
next = $('.result:last');
}