Switch to adjacent buffer with alt+arrow

Use alt+up and alt+down to switch to previous / next buffer.
Works when bufferlist is nested or flat.

This implements issue #511.
This commit is contained in:
Mukunda Modell 2015-12-01 17:02:32 -06:00
commit 3b60f992b4
3 changed files with 21 additions and 1 deletions

View file

@ -727,6 +727,18 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
settings.nonicklist = !settings.nonicklist;
};
$rootScope.switchToAdjacentBuffer = function(direction) {
// direction is +1 for next buffer, -1 for previous buffer
var sortedBuffers = _.sortBy($scope.getBuffers(), $rootScope.predicate);
var activeBuffer = models.getActiveBuffer();
var index = sortedBuffers.indexOf(activeBuffer);
if (index >= 0) {
var newBuffer = sortedBuffers[index + direction];
if (newBuffer) {
$scope.setActiveBuffer(newBuffer.id);
}
}
};
$scope.handleSearchBoxKey = function($event) {
// Support different browser quirks