Don't switch to hidden buffers with Alt-Up/Down either
This commit is contained in:
parent
a14941ab7d
commit
063b91d5c2
1 changed files with 12 additions and 6 deletions
|
@ -819,12 +819,18 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
||||||
// direction is +1 for next buffer, -1 for previous buffer
|
// direction is +1 for next buffer, -1 for previous buffer
|
||||||
var sortedBuffers = _.sortBy($scope.getBuffers(), $rootScope.predicate);
|
var sortedBuffers = _.sortBy($scope.getBuffers(), $rootScope.predicate);
|
||||||
var activeBuffer = models.getActiveBuffer();
|
var activeBuffer = models.getActiveBuffer();
|
||||||
var index = sortedBuffers.indexOf(activeBuffer);
|
var index = sortedBuffers.indexOf(activeBuffer) + direction;
|
||||||
if (index >= 0) {
|
var newBuffer;
|
||||||
var newBuffer = sortedBuffers[index + direction];
|
|
||||||
if (newBuffer) {
|
// look for next non-hidden buffer
|
||||||
$scope.setActiveBuffer(newBuffer.id);
|
while (index >= 0 && index < sortedBuffers.length &&
|
||||||
|
(!newBuffer || newBuffer.hidden)) {
|
||||||
|
newBuffer = sortedBuffers[index];
|
||||||
|
index += direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!!newBuffer) {
|
||||||
|
$scope.setActiveBuffer(newBuffer.id);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue