From 4bacb850cf97169e12f78c14d1b4c26b60b3efb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Thu, 30 Apr 2020 11:20:09 +0200 Subject: [PATCH] Check weechat version --- js/inputbar.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/js/inputbar.js b/js/inputbar.js index 26d2c89..380429b 100644 --- a/js/inputbar.js +++ b/js/inputbar.js @@ -79,8 +79,10 @@ weechat.directive('inputBar', function() { }; $scope.completeNick = function() { - if ( $scope.command.startsWith('/') ) { - // We are completing a command, an other function will do this + if ((models.version[0] == 2 && models.version[1] >= 9 || models.version[0] > 2) && + $scope.command.startsWith('/') ) { + // We are completing a command, another function will do + // this on WeeChat 2.9 and later return; } @@ -124,6 +126,11 @@ weechat.directive('inputBar', function() { var commandCompletionPositionInList; var commandCompletionInputChanged; $scope.completeCommand = function(direction) { + if (models.version[0] < 2 || (models.version[0] == 2 && models.version[1] < 9)) { + // Command completion is only supported on WeeChat 2.9+ + return; + } + if ( !$scope.command.startsWith('/') ) { // We are not completing a command, maybe a nick? return;