New keybinding: Alt-< to switch to previous buffer. Same key as WeeChat
This commit is contained in:
parent
0bfbd3eb0b
commit
2aa1e02bea
2 changed files with 21 additions and 1 deletions
|
@ -968,6 +968,16 @@ weechat.directive('inputBar', function() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Alt+< -> switch to previous buffer
|
||||||
|
if ($event.altKey && code === 60) {
|
||||||
|
var previousBuffer = models.getPreviousBuffer();
|
||||||
|
if (previousBuffer) {
|
||||||
|
models.setActiveBuffer(previousBuffer.id);
|
||||||
|
$event.preventDefault();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Escape -> disconnect
|
// Escape -> disconnect
|
||||||
if (code === 27) {
|
if (code === 27) {
|
||||||
$event.preventDefault();
|
$event.preventDefault();
|
||||||
|
|
12
js/models.js
12
js/models.js
|
@ -329,6 +329,7 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
|
||||||
|
|
||||||
var BufferList = [];
|
var BufferList = [];
|
||||||
activeBuffer = null;
|
activeBuffer = null;
|
||||||
|
previousBuffer = null;
|
||||||
unreads = 0;
|
unreads = 0;
|
||||||
notifications = 0;
|
notifications = 0;
|
||||||
|
|
||||||
|
@ -368,6 +369,15 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
|
||||||
return activeBuffer;
|
return activeBuffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns the previous current active buffer
|
||||||
|
*
|
||||||
|
* @return previous buffer object
|
||||||
|
*/
|
||||||
|
this.getPreviousBuffer = function() {
|
||||||
|
return previousBuffer;
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sets the buffer specifiee by bufferId as active.
|
* Sets the buffer specifiee by bufferId as active.
|
||||||
* Deactivates the previous current buffer.
|
* Deactivates the previous current buffer.
|
||||||
|
@ -380,7 +390,7 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
|
||||||
key = 'id';
|
key = 'id';
|
||||||
}
|
}
|
||||||
|
|
||||||
var previousBuffer = this.getActiveBuffer();
|
previousBuffer = this.getActiveBuffer();
|
||||||
|
|
||||||
activeBuffer = _.find(this.model.buffers, function(buffer) {
|
activeBuffer = _.find(this.model.buffers, function(buffer) {
|
||||||
if (buffer[key] === bufferId) {
|
if (buffer[key] === bufferId) {
|
||||||
|
|
Loading…
Reference in a new issue