1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 06:15:16 +03:00

bugfix for glitchy vertical text position in CLI

This commit is contained in:
cTn 2014-05-26 14:11:30 +02:00
parent 5042d2af2e
commit 6d38e301ef
3 changed files with 9 additions and 6 deletions

View file

@ -29,7 +29,7 @@
margin-top: 8px; margin-top: 8px;
height: 20px; height: 22px;
line-height: 20px; line-height: 20px;
padding-left: 5px; padding-left: 5px;

View file

@ -5,5 +5,5 @@
<div class="wrapper"> <div class="wrapper">
</div> </div>
</div> </div>
<textarea name="commands" i18n_placeholder="cliInputPlaceholder" rows="0" cols="0"></textarea> <textarea name="commands" i18n_placeholder="cliInputPlaceholder" rows="1" cols="0"></textarea>
</div> </div>

View file

@ -43,18 +43,21 @@ function tab_initialize_cli() {
serial.send(bufferOut, function(writeInfo) {}); serial.send(bufferOut, function(writeInfo) {});
var textarea = $('.tab-cli textarea'); var textarea = $('.tab-cli textarea');
textarea.keypress(function(event) { textarea.keypress(function(event) {
if (event.which == 13) { // enter if (event.which == 13) { // enter
var out_string = $('.tab-cli textarea').val(); event.preventDefault(); // prevent the adding of new line
var out_string = textarea.val();
var out_arr = out_string.split("\n"); var out_arr = out_string.split("\n");
cli_history.add(out_string.trim()); cli_history.add(out_string.trim());
var timeout_needle = 0;
var timeout_needle = 0;
for (var i = 0; i < out_arr.length; i++) { for (var i = 0; i < out_arr.length; i++) {
send_slowly(out_arr, i, timeout_needle++); send_slowly(out_arr, i, timeout_needle++);
} }
$('.tab-cli textarea').val(''); textarea.val('');
} }
}); });
@ -69,7 +72,7 @@ function tab_initialize_cli() {
}); });
// give input element user focus // give input element user focus
$('.tab-cli textarea').focus(); textarea.focus();
}); });
} }