Skip to content

Commit

Permalink
Merge pull request #1246 from torhve/handlebuffercleared
Browse files Browse the repository at this point in the history
Handle buffer cleared
  • Loading branch information
lorenzhs committed Mar 25, 2023
2 parents 8c5eaeb + d649306 commit faa515a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/js/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ weechat.factory('handlers', ['$rootScope', '$log', 'models', 'plugins', 'notific
}
}
};
const handleBufferCleared = function(message) {
var bufferMessage = message.objects[0].content[0];
var bufferId = bufferMessage.pointers[0];
let buffer = models.getBuffer(bufferId);
$log.debug('Handle buffer cleared: ' + buffer.fullName);
buffer.clear();
};

var handleBufferClosing = function(message) {
var bufferMessage = message.objects[0].content[0];
Expand Down Expand Up @@ -501,6 +508,7 @@ weechat.factory('handlers', ['$rootScope', '$log', 'models', 'plugins', 'notific
};

var eventHandlers = {
_buffer_cleared: handleBufferCleared,
_buffer_closing: handleBufferClosing,
_buffer_line_added: handleBufferLineAdded,
_buffer_localvar_added: handleBufferLocalvarChanged,
Expand Down Expand Up @@ -542,4 +550,4 @@ weechat.factory('handlers', ['$rootScope', '$log', 'models', 'plugins', 'notific
handleCompletion: handleCompletion
};

}]);
}]);

0 comments on commit faa515a

Please sign in to comment.