From 71252fb4d548311ed5063583e538ee303b48d640 Mon Sep 17 00:00:00 2001 From: Daniel Kessler Date: Thu, 4 Oct 2018 23:50:09 -0700 Subject: [PATCH 1/2] Handle buffer_moved --- js/handlers.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/js/handlers.js b/js/handlers.js index 2867d8e..08978d0 100644 --- a/js/handlers.js +++ b/js/handlers.js @@ -277,6 +277,27 @@ weechat.factory('handlers', ['$rootScope', '$log', 'models', 'plugins', 'notific } }; + var handleBufferMoved = function(message) { + var obj = message.objects[0].content[0]; + var buffer = obj.pointers[0]; + var old = models.getBuffer(buffer); + + var old_number = old.number; + var new_number = obj.number; + + _.each(models.getBuffers(), function(buffer) { + if (buffer.number > old_number && buffer.number <= new_number) { + buffer.number -= 1; + } + + if (buffer.number < old_number && buffer.number >= new_number) { + buffer.number += 1; + } + }); + + old.number = new_number; + } + var handleBufferHidden = function(message) { var obj = message.objects[0].content[0]; var buffer = obj.pointers[0]; @@ -438,6 +459,7 @@ weechat.factory('handlers', ['$rootScope', '$log', 'models', 'plugins', 'notific _buffer_localvar_added: handleBufferLocalvarChanged, _buffer_localvar_removed: handleBufferLocalvarChanged, _buffer_localvar_changed: handleBufferLocalvarChanged, + _buffer_moved: handleBufferMoved, _buffer_opened: handleBufferOpened, _buffer_title_changed: handleBufferTitleChanged, _buffer_type_changed: handleBufferTypeChanged, From e5e81ea17711f528e0b94ca798b8a6e1aa4234a1 Mon Sep 17 00:00:00 2001 From: Daniel Kessler Date: Fri, 5 Oct 2018 00:18:52 -0700 Subject: [PATCH 2/2] add semicolon --- js/handlers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/handlers.js b/js/handlers.js index 08978d0..795268b 100644 --- a/js/handlers.js +++ b/js/handlers.js @@ -296,7 +296,7 @@ weechat.factory('handlers', ['$rootScope', '$log', 'models', 'plugins', 'notific }); old.number = new_number; - } + }; var handleBufferHidden = function(message) { var obj = message.objects[0].content[0];