Merge pull request #603 from torhve/fix-query-open-buffer
Switch to buffer after issuing /query. Fixes #318
This commit is contained in:
commit
4fe4b8a5d3
3 changed files with 25 additions and 4 deletions
|
@ -107,10 +107,6 @@ weechat.factory('handlers', ['$rootScope', '$log', 'models', 'plugins', 'notific
|
|||
var bufferMessage = message.objects[0].content[0];
|
||||
var buffer = new models.Buffer(bufferMessage);
|
||||
models.addBuffer(buffer);
|
||||
/* Until we can decide if user asked for this buffer to be opened
|
||||
* or not we will let user click opened buffers.
|
||||
models.setActiveBuffer(buffer.id);
|
||||
*/
|
||||
};
|
||||
|
||||
var handleBufferTitleChanged = function(message) {
|
||||
|
@ -138,6 +134,15 @@ weechat.factory('handlers', ['$rootScope', '$log', 'models', 'plugins', 'notific
|
|||
// prefix + fullname, which would happen otherwise). Else, use null so that full_name is used
|
||||
old.trimmedName = obj.short_name.replace(/^[#&+]/, '') || (obj.short_name ? ' ' : null);
|
||||
old.prefix = ['#', '&', '+'].indexOf(obj.short_name.charAt(0)) >= 0 ? obj.short_name.charAt(0) : '';
|
||||
|
||||
// After a buffer openes we get the name change event from relay protocol
|
||||
// Here we check our outgoing commands that openes a buffer and switch
|
||||
// to it if we find the buffer name it the list
|
||||
var position = models.outgoingQueries.indexOf(old.shortName);
|
||||
if (position >= 0) {
|
||||
models.outgoingQueries.splice(position, 1);
|
||||
models.setActiveBuffer(old.id);
|
||||
}
|
||||
};
|
||||
|
||||
var handleBufferLocalvarChanged = function(message) {
|
||||
|
|
|
@ -100,6 +100,19 @@ weechat.directive('inputBar', function() {
|
|||
ab.clear();
|
||||
}
|
||||
|
||||
// Check against a list of commands that opens a new
|
||||
// buffer and save the name of the buffer so we can
|
||||
// also automatically switch to the new buffer in gb
|
||||
var opencommands = ['/query', '/join', '/j', '/q'];
|
||||
var spacepos = $scope.command.indexOf(' ');
|
||||
var firstword = $scope.command.substr(0, spacepos);
|
||||
var index = opencommands.indexOf(firstword);
|
||||
if (index >= 0) {
|
||||
var queryName = $scope.command.substring(spacepos + 1);
|
||||
// Cache our queries so when a buffer gets opened we can open in UI
|
||||
models.outgoingQueries.push(queryName);
|
||||
}
|
||||
|
||||
// Empty the input after it's sent
|
||||
$scope.command = '';
|
||||
}
|
||||
|
|
|
@ -11,6 +11,9 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
|
|||
// WeeChat version
|
||||
this.version = null;
|
||||
|
||||
// Save outgoing queries
|
||||
this.outgoingQueries = [];
|
||||
|
||||
var parseRichText = function(text) {
|
||||
var textElements = weeChat.Protocol.rawText2Rich(text),
|
||||
typeToClassPrefixFg = {
|
||||
|
|
Loading…
Reference in a new issue