Don't switch to hidden buffers with Alt-Up/Down either

This commit is contained in:
Lorenz Hübschle-Schneider 2018-04-03 14:32:28 +02:00
parent a14941ab7d
commit 063b91d5c2

View file

@ -819,12 +819,18 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
// 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);
var index = sortedBuffers.indexOf(activeBuffer) + direction;
var newBuffer;
// look for next non-hidden buffer
while (index >= 0 && index < sortedBuffers.length &&
(!newBuffer || newBuffer.hidden)) {
newBuffer = sortedBuffers[index];
index += direction;
}
if (!!newBuffer) {
$scope.setActiveBuffer(newBuffer.id);
}
};