Merge pull request #939 from SimonSapin/ctrl-w-w-w-w

Fix Ctrl+W when the cursor follows a space.
This commit is contained in:
Lorenz Hübschle-Schneider 2017-05-06 13:12:34 +02:00 committed by GitHub
commit 92d707a51d

View file

@ -467,7 +467,7 @@ weechat.directive('inputBar', function() {
// Ctrl-w
} else if (code == 87) {
var trimmedValue = $scope.command.slice(0, caretPos);
var lastSpace = trimmedValue.lastIndexOf(' ') + 1;
var lastSpace = trimmedValue.replace(/\s+$/, '').lastIndexOf(' ') + 1;
$scope.command = $scope.command.slice(0, lastSpace) + $scope.command.slice(caretPos, $scope.command.length);
setTimeout(function() {
inputNode.setSelectionRange(lastSpace, lastSpace);