Isolate the nick completion in the inputbar's scope
This commit is contained in:
parent
03cb90c036
commit
59206770e2
|
@ -687,7 +687,7 @@ weechat.directive('inputBar', function() {
|
||||||
angular.element('#sendMessage').focus();
|
angular.element('#sendMessage').focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
$rootScope.completeNick = function() {
|
$scope.completeNick = function() {
|
||||||
// input DOM node
|
// input DOM node
|
||||||
var inputNode = document.getElementById('sendMessage');
|
var inputNode = document.getElementById('sendMessage');
|
||||||
|
|
||||||
|
@ -702,10 +702,10 @@ weechat.directive('inputBar', function() {
|
||||||
|
|
||||||
// complete nick
|
// complete nick
|
||||||
var nickComp = IrcUtils.completeNick(inputText, caretPos,
|
var nickComp = IrcUtils.completeNick(inputText, caretPos,
|
||||||
$rootScope.iterCandidate, activeBuffer.flatNicklist(), ':');
|
$scope.iterCandidate, activeBuffer.flatNicklist(), ':');
|
||||||
|
|
||||||
// remember iteration candidate
|
// remember iteration candidate
|
||||||
$rootScope.iterCandidate = nickComp.iterCandidate;
|
$scope.iterCandidate = nickComp.iterCandidate;
|
||||||
|
|
||||||
// update current input
|
// update current input
|
||||||
$scope.command = nickComp.text;
|
$scope.command = nickComp.text;
|
||||||
|
@ -733,8 +733,8 @@ weechat.directive('inputBar', function() {
|
||||||
var code = $event.keyCode ? $event.keyCode : $event.charCode;
|
var code = $event.keyCode ? $event.keyCode : $event.charCode;
|
||||||
|
|
||||||
// any other key than Tab resets nick completion iteration
|
// any other key than Tab resets nick completion iteration
|
||||||
var tmpIterCandidate = $rootScope.iterCandidate;
|
var tmpIterCandidate = $scope.iterCandidate;
|
||||||
$rootScope.iterCandidate = null;
|
$scope.iterCandidate = null;
|
||||||
|
|
||||||
// Left Alt+[0-9] -> jump to buffer
|
// Left Alt+[0-9] -> jump to buffer
|
||||||
if ($event.altKey && !$event.ctrlKey && (code > 47 && code < 58)) {
|
if ($event.altKey && !$event.ctrlKey && (code > 47 && code < 58)) {
|
||||||
|
@ -753,15 +753,15 @@ weechat.directive('inputBar', function() {
|
||||||
// Tab -> nick completion
|
// Tab -> nick completion
|
||||||
if (code == 9 && !$event.altKey && !$event.ctrlKey) {
|
if (code == 9 && !$event.altKey && !$event.ctrlKey) {
|
||||||
$event.preventDefault();
|
$event.preventDefault();
|
||||||
$rootScope.iterCandidate = tmpIterCandidate;
|
$scope.iterCandidate = tmpIterCandidate;
|
||||||
$rootScope.completeNick();
|
$scope.completeNick();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alt+A -> switch to buffer with activity
|
// Alt+A -> switch to buffer with activity
|
||||||
if ($event.altKey && (code == 97 || code == 65)) {
|
if ($event.altKey && (code == 97 || code == 65)) {
|
||||||
$event.preventDefault();
|
$event.preventDefault();
|
||||||
$rootScope.switchToActivityBuffer();
|
$scope.switchToActivityBuffer();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue