mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-16 21:05:28 +03:00
some custom handling of ANSI escape codes
This commit is contained in:
parent
b040b01be8
commit
906bc4230a
1 changed files with 34 additions and 14 deletions
20
tabs/cli.js
20
tabs/cli.js
|
@ -62,7 +62,26 @@ function leave_CLI(callback) {
|
||||||
Linux and Unix only understand LF
|
Linux and Unix only understand LF
|
||||||
Windows understands (both) CRLF
|
Windows understands (both) CRLF
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var sequence_elements = 0;
|
||||||
|
|
||||||
function handle_CLI(data) {
|
function handle_CLI(data) {
|
||||||
|
if (data == 27 || sequence_elements > 0) { // ESC + other
|
||||||
|
sequence_elements++;
|
||||||
|
|
||||||
|
// delete previous space
|
||||||
|
if (sequence_elements == 1) {
|
||||||
|
var content_string = $('.tab-cli .window .wrapper').html();
|
||||||
|
var new_string = content_string.substring(0, content_string.length -1);
|
||||||
|
$('.tab-cli .window .wrapper').html(new_string);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset
|
||||||
|
if (sequence_elements >= 5) {
|
||||||
|
sequence_elements = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sequence_elements == 0) {
|
||||||
switch (data) {
|
switch (data) {
|
||||||
case 10: // line feed
|
case 10: // line feed
|
||||||
if (OS == "Windows" || OS == "Linux" || OS == "UNIX") {
|
if (OS == "Windows" || OS == "Linux" || OS == "UNIX") {
|
||||||
|
@ -79,3 +98,4 @@ function handle_CLI(data) {
|
||||||
$('.tab-cli .window').scrollTop($('.tab-cli .window .wrapper').height());
|
$('.tab-cli .window').scrollTop($('.tab-cli .window .wrapper').height());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue