Merge pull request #291 from torhve/fix-empty
Don't send empty commands, use angular model instead of accessing element value directly. Fixes problem with pressing enter will send previous value in history.
This commit is contained in:
commit
236b0da97b
1 changed files with 18 additions and 13 deletions
|
@ -1279,8 +1279,12 @@ weechat.directive('inputBar', function() {
|
|||
var input = $scope.getInputNode();
|
||||
var ab = models.getActiveBuffer();
|
||||
|
||||
// It's undefined early in the lifecycle of the program.
|
||||
// Don't send empty commands
|
||||
if($scope.command !== undefined && $scope.command !== '') {
|
||||
|
||||
// log to buffer history
|
||||
ab.addToHistory(input.value);
|
||||
ab.addToHistory($scope.command);
|
||||
|
||||
// Split the command into multiple commands based on line breaks
|
||||
_.each($scope.command.split(/\r?\n/), function(line) {
|
||||
|
@ -1294,7 +1298,8 @@ weechat.directive('inputBar', function() {
|
|||
}
|
||||
|
||||
// Empty the input after it's sent
|
||||
input.value = '';
|
||||
$scope.command = '';
|
||||
}
|
||||
};
|
||||
|
||||
// Handle key presses in the input bar
|
||||
|
|
Loading…
Reference in a new issue