Move completeNick method to inputBar directive

This commit is contained in:
David Cormier 2013-10-27 17:05:44 -04:00
parent ef24986431
commit 03cb90c036

View file

@ -641,33 +641,6 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
}
}
$rootScope.completeNick = function() {
// input DOM node
var inputNode = document.getElementById('sendMessage');
// get current input
var inputText = inputNode.value;
// get current caret position
var caretPos = inputNode.selectionStart;
// create flat array of nicks
var activeBuffer = models.getActiveBuffer();
// complete nick
var nickComp = IrcUtils.completeNick(inputText, caretPos,
$rootScope.iterCandidate, activeBuffer.flatNicklist(), ':');
// remember iteration candidate
$rootScope.iterCandidate = nickComp.iterCandidate;
// update current input
$scope.command = nickComp.text;
// update current caret position
inputNode.focus();
inputNode.setSelectionRange(nickComp.caretPos, nickComp.caretPos);
}
$scope.handleKeyPress = function($event) {
};
@ -743,7 +716,6 @@ weechat.directive('inputBar', function() {
}
// Send the message to the websocket
$scope.sendMessage = function() {
connection.sendMessage($scope.command);