|
|
@ -148,6 +148,9 @@ weechat.directive('inputBar', function() { |
|
|
|
// Support different browser quirks
|
|
|
|
// Support different browser quirks
|
|
|
|
var code = $event.keyCode ? $event.keyCode : $event.charCode; |
|
|
|
var code = $event.keyCode ? $event.keyCode : $event.charCode; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// reset quick keys display
|
|
|
|
|
|
|
|
$rootScope.showQuickKeys = false; |
|
|
|
|
|
|
|
|
|
|
|
// any other key than Tab resets nick completion iteration
|
|
|
|
// any other key than Tab resets nick completion iteration
|
|
|
|
var tmpIterCandidate = $scope.iterCandidate; |
|
|
|
var tmpIterCandidate = $scope.iterCandidate; |
|
|
|
$scope.iterCandidate = null; |
|
|
|
$scope.iterCandidate = null; |
|
|
@ -157,8 +160,16 @@ weechat.directive('inputBar', function() { |
|
|
|
if (code === 48) { |
|
|
|
if (code === 48) { |
|
|
|
code = 58; |
|
|
|
code = 58; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var bufferNumber = code - 48 - 1 ; |
|
|
|
var bufferNumber = code - 48 - 1 ; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var activeBufferId; |
|
|
|
|
|
|
|
// quick select filtered entries
|
|
|
|
|
|
|
|
if (($scope.$parent.search.length || $scope.$parent.onlyUnread) && $scope.$parent.filteredBuffers.length) { |
|
|
|
|
|
|
|
var filteredBufferNum = $scope.$parent.filteredBuffers[bufferNumber]; |
|
|
|
|
|
|
|
if (filteredBufferNum !== undefined) { |
|
|
|
|
|
|
|
activeBufferId = [filteredBufferNum.number, filteredBufferNum.id]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
// Map the buffers to only their numbers and IDs so we don't have to
|
|
|
|
// Map the buffers to only their numbers and IDs so we don't have to
|
|
|
|
// copy the entire (possibly very large) buffer object, and then sort
|
|
|
|
// copy the entire (possibly very large) buffer object, and then sort
|
|
|
|
// the buffers according to their WeeChat number
|
|
|
|
// the buffers according to their WeeChat number
|
|
|
@ -169,7 +180,8 @@ weechat.directive('inputBar', function() { |
|
|
|
// Pass an ordering function to sort by first element.
|
|
|
|
// Pass an ordering function to sort by first element.
|
|
|
|
return left[0] - right[0]; |
|
|
|
return left[0] - right[0]; |
|
|
|
}); |
|
|
|
}); |
|
|
|
var activeBufferId = sortedBuffers[bufferNumber]; |
|
|
|
activeBufferId = sortedBuffers[bufferNumber]; |
|
|
|
|
|
|
|
} |
|
|
|
if (activeBufferId) { |
|
|
|
if (activeBufferId) { |
|
|
|
$scope.$parent.setActiveBuffer(activeBufferId[1]); |
|
|
|
$scope.$parent.setActiveBuffer(activeBufferId[1]); |
|
|
|
$event.preventDefault(); |
|
|
|
$event.preventDefault(); |
|
|
@ -356,6 +368,28 @@ weechat.directive('inputBar', function() { |
|
|
|
$event.preventDefault(); |
|
|
|
$event.preventDefault(); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Alt key down -> display quick key legend
|
|
|
|
|
|
|
|
if ($event.type === "keydown" && code === 18 && !$event.ctrlKey && !$event.shiftKey) { |
|
|
|
|
|
|
|
$rootScope.showQuickKeys = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$rootScope.handleKeyRelease = function($event) { |
|
|
|
|
|
|
|
// Alt key up -> remove quick key legend
|
|
|
|
|
|
|
|
if ($event.keyCode === 18) { |
|
|
|
|
|
|
|
if ($rootScope.quickKeysTimer !== undefined) { |
|
|
|
|
|
|
|
clearTimeout($rootScope.quickKeysTimer); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$rootScope.quickKeysTimer = setTimeout(function() { |
|
|
|
|
|
|
|
if ($rootScope.showQuickKeys) { |
|
|
|
|
|
|
|
$rootScope.showQuickKeys = false; |
|
|
|
|
|
|
|
$rootScope.$apply(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
delete $rootScope.quickKeysTimer; |
|
|
|
|
|
|
|
}, 1000); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
}] |
|
|
|
}] |
|
|
|
}; |
|
|
|
}; |
|
|
|