diff --git a/css/glowingbear.css b/css/glowingbear.css index d6e36fa..81549be 100644 --- a/css/glowingbear.css +++ b/css/glowingbear.css @@ -100,8 +100,10 @@ body { padding-bottom:70px; } -input#sendMessage { +#sendMessage { width: 100%; + height: 36px; + resize: none; } #footer button { border-radius: 0; @@ -109,7 +111,7 @@ input#sendMessage { .panel input, .panel .input-group { max-width: 300px; } -input[type=text], input[type=password], .badge { +input[type=text], input[type=password], #sendMessage, .badge { border: 0; border-radius: 0; color: #ccc; diff --git a/directives/input.html b/directives/input.html index 4b58053..27eb6be 100644 --- a/directives/input.html +++ b/directives/input.html @@ -1,6 +1,7 @@ -
+
- + diff --git a/js/glowingbear.js b/js/glowingbear.js index 5a42194..84bfbdc 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -1217,7 +1217,10 @@ weechat.directive('inputBar', function() { * Returns the input element */ $scope.getInputNode = function() { - return $element.find('input')[0]; + return $element.find('#'+$scope.inputId)[0]; + }; + $scope.getForm = function() { + return $element.find('form')[0]; }; $scope.completeNick = function() { @@ -1253,8 +1256,11 @@ weechat.directive('inputBar', function() { $scope.sendMessage = function() { var input = $scope.getInputNode(); - connection.sendMessage(input.value); models.getActiveBuffer().addToHistory(input.value); // log to buffer history + // Split the command into multiple commands based on line breaks + _.each($scope.command.split(/\r?\n/), function(line) { + connection.sendMessage(line); + }); input.value = ''; }; @@ -1363,6 +1369,14 @@ weechat.directive('inputBar', function() { // We don't need to set the cursor to the rightmost position here, the browser does that for us return true; } + + // Enter to submit, shift-enter for newline + // + if (code == 13 && !$event.shiftKey) { + $event.preventDefault(); + $scope.sendMessage(); + return true; + } }; } };