Fix bug with switching to core buffer when buffer is closed
This commit is contained in:
parent
4b5192ce7f
commit
3c01ad1b68
|
@ -361,15 +361,17 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Closes a weechat buffer. Sets the first buffer
|
* Closes a weechat buffer. Sets the first buffer
|
||||||
* as active.
|
* as active, if the closing buffer was active before
|
||||||
*
|
*
|
||||||
* @param bufferId id of the buffer to close
|
* @param bufferId id of the buffer to close
|
||||||
* @return undefined
|
* @return undefined
|
||||||
*/
|
*/
|
||||||
this.closeBuffer = function(bufferId) {
|
this.closeBuffer = function(bufferId) {
|
||||||
|
var wasActive = this.model['buffers'][bufferId.id].active;
|
||||||
delete(this.model['buffers'][bufferId.id]);
|
if(wasActive) {
|
||||||
var firstBuffer = _.keys(this.model['buffers'])[0];
|
var firstBuffer = _.keys(this.model['buffers'])[0];
|
||||||
this.setActiveBuffer(firstBuffer);
|
this.setActiveBuffer(firstBuffer);
|
||||||
}
|
}
|
||||||
|
delete(this.model['buffers'][bufferId.id]);
|
||||||
|
}
|
||||||
}]);
|
}]);
|
||||||
|
|
Loading…
Reference in New Issue