Merge pull request #999 from lorenzhs/alt-a-hidden-buffers
Don't jump to hidden buffers with Alt-A
This commit is contained in:
commit
41a066ead1
1 changed files with 14 additions and 8 deletions
|
@ -796,7 +796,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||
// Try to find buffer with notification
|
||||
for (i in sortedBuffers) {
|
||||
buffer = sortedBuffers[i];
|
||||
if (buffer.notification > 0) {
|
||||
if (buffer.notification > 0 && !buffer.hidden) {
|
||||
$scope.setActiveBuffer(buffer.id);
|
||||
return; // return instead of break so that the second for loop isn't executed
|
||||
}
|
||||
|
@ -804,7 +804,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||
// No notifications, find first buffer with unread lines instead
|
||||
for (i in sortedBuffers) {
|
||||
buffer = sortedBuffers[i];
|
||||
if (buffer.unread > 0) {
|
||||
if (buffer.unread > 0 && !buffer.hidden) {
|
||||
$scope.setActiveBuffer(buffer.id);
|
||||
return;
|
||||
}
|
||||
|
@ -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