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
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue