From d2e8ca4a25d056417e67bc0bd19271c601ca22b1 Mon Sep 17 00:00:00 2001 From: Bernhard Kirchen Date: Sun, 3 Apr 2022 06:22:00 +0200 Subject: [PATCH 1/5] console: keep cursor at the end of command input move the text cursor to the end of the command input when filling the console command from history using JavsScript. this hopefully is more convenient to most users and is similar to the behavior of a desktop terminal. --- tasmota/html_compressed/HTTP_SCRIPT_CONSOL.h | 19 +++++++++++-------- .../html_uncompressed/HTTP_SCRIPT_CONSOL.h | 8 +++++++- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/tasmota/html_compressed/HTTP_SCRIPT_CONSOL.h b/tasmota/html_compressed/HTTP_SCRIPT_CONSOL.h index b57f5f78f..e43426c6f 100644 --- a/tasmota/html_compressed/HTTP_SCRIPT_CONSOL.h +++ b/tasmota/html_compressed/HTTP_SCRIPT_CONSOL.h @@ -2,7 +2,7 @@ // compressed by tools/unishox/compress-html-uncompressed.py ///////////////////////////////////////////////////////////////////// -const size_t HTTP_SCRIPT_CONSOL_SIZE = 952; +const size_t HTTP_SCRIPT_CONSOL_SIZE = 1046; const char HTTP_SCRIPT_CONSOL_COMPRESSED[] PROGMEM = "\x33\xBF\xAF\x71\xF0\xE3\x3A\x8B\x44\x3E\x1C\x67\x51\x18\xA3\xA8\x2A\x2B\x1A\x7C" "\x3E\x84\x3C\x18\x17\xC1\xD6\xE7\x20\x8E\xE8\xC3\xBC\x7B\x4C\xEF\xE8\x33\xAB\x0F" "\x87\xD9\xF6\x78\x0C\x27\x7F\x2A\x2B\xD1\xAF\x05\xD1\xDD\x0A\x8E\xF0\x24\xCD\x31" @@ -30,12 +30,15 @@ const char HTTP_SCRIPT_CONSOL_COMPRESSED[] PROGMEM = "\x33\xBF\xAF\x71\xF0\xE3\x "\x09\x83\xFC\x7D\x9D\x40\x89\xC7\xF3\x04\x1E\x37\x07\x02\x27\x38\xA7\x50\x67\xC6" "\x74\x34\x66\x44\x1E\x08\xCF\x1A\x60\xEE\x9C\xBF\x9F\x0F\x84\x19\xFE\x3F\xC7\x31" "\x9F\x0F\x84\x19\xDE\x3D\xA3\x8E\x96\x2E\xB0\x3C\x1A\x30\x27\x4C\xF8\x7D\xE1\x83" - "\x07\xD9\xE0\xF7\x1C\xBF\x9F\x0F\x84\x19\xDA\x3B\xA7\x6C\xED\x87\xC7\xE0\xA0\xC1" - "\x0B\x8C\xD3\xF4\x7E\x8E\xE8\x7C\x7C\x04\x49\x67\x78\xEA\x1C\x08\x5C\x80\x8A\x0C" - "\xF7\x83\xE3\xAC\xE4\x3D\xF3\xFC\x7F\x8F\xB3\xEC\xEF\x1E\x78\xCF\x87\xC2\x0C\xED" - "\x1D\xD3\x8C\xFC\x3A\xCE\xB2\x0F\x81\x07\x10\x38\xC8\x14\xF0\x83\x92\xCF\x87\xC2" - "\x0C\xFD\x1F\xA3\xBA\x08\x99\x89\xF8\x72\x23\xF4\x7E\x88\x50\x67\x41\x98\x30\xEE" - "\x9D\xE3\xA8\x50\x67\x41\x7C\x08\x3C\xAB\x82\x16\x38\x77\x8E\xA0\xF8\xF8\x71\x9D" - "\xE3\xDC\x77\x8F\x07\xB8\x87\xC2\x3B\xA2\x8E\xF1\xE0"; + "\x07\xD9\xE0\x11\xB8\x10\x04\x4C\xD0\x71\xDE\x3D\xA3\x8E\x86\x30\x31\x7E\x3B\xA7" + "\x78\xF0\x38\xE9\xE7\x45\xE6\x13\x0E\xB7\x38\xBF\x7C\x3C\xCE\xE8\xE0\x41\xE3\xA0" + "\x10\xB8\xFA\x3A\x90\x24\xCC\x3B\xC7\x83\xDC\x75\x23\x8C\xEA\x3B\x84\x38\xEF\x1E" + "\x0F\x71\xCB\xF9\xF0\xF8\x41\x9D\xA3\xBA\x76\xCE\xD8\x7C\x7E\x0A\x0C\x10\xAE\x9F" + "\xA3\xF4\x77\x43\xE3\xE0\x22\x4B\x3B\xC7\x50\x21\x63\x87\xC1\x41\x9E\xF0\x7C\x75" + "\x9C\x87\xBE\x7F\x8F\xF1\xF6\x7D\x9D\xE3\xCF\x19\xF0\xF8\x41\x9D\xA3\xBA\x71\x9F" + "\x87\x59\xD6\x41\xF0\x20\xE2\x07\x19\x02\x9E\x10\x72\x59\xF0\xF8\x41\x9F\xA3\xF4" + "\x77\x41\x13\x31\x3F\x0E\x44\x7E\x8F\xD1\x0A\x0C\xE8\x33\x06\x1D\xD3\xBC\x75\x0A" + "\x0C\xE8\x2F\x81\x07\x9B\x50\x42\xC7\x0E\xF1\xD4\x1F\x1F\x0E\x33\xBC\x7B\x8E\xF1" + "\xE0\xF7\x10\xF8\x47\x74\x51\xDE\x3C\x1B"; #define HTTP_SCRIPT_CONSOL Decompress(HTTP_SCRIPT_CONSOL_COMPRESSED,HTTP_SCRIPT_CONSOL_SIZE).c_str() \ No newline at end of file diff --git a/tasmota/html_uncompressed/HTTP_SCRIPT_CONSOL.h b/tasmota/html_uncompressed/HTTP_SCRIPT_CONSOL.h index bb5b47e69..543e7978f 100644 --- a/tasmota/html_uncompressed/HTTP_SCRIPT_CONSOL.h +++ b/tasmota/html_uncompressed/HTTP_SCRIPT_CONSOL.h @@ -45,7 +45,13 @@ const char HTTP_SCRIPT_CONSOL[] PROGMEM = // "if(!(navigator.maxTouchPoints||'ontouchstart'in document.documentElement)){eb('c1').autocomplete='off';}" // No touch so stop browser autocomplete "eb('c1').addEventListener('keydown',function(e){" "var b=eb('c1'),c=e.keyCode;" // c1 = Console command id - "if(38==c||40==c){b.autocomplete='off';}" // ArrowUp or ArrowDown must be a keyboard so stop browser autocomplete + "if(38==c||40==c){" // ArrowUp or ArrowDown + "b.autocomplete='off';" // ArrowUp or ArrowDown must be a keyboard so stop browser autocomplete + "setTimeout(function(b){" // for best compatibility (chrome) we need to schedule this function + "b.focus();" // for best compatibility (chrome) we need to (re)focus the input element + "b.setSelectionRange(b.value.length, b.value.length);" // move cursor to the end of the command inserted from history + "}, 0, b);" + "}" "38==c?(++cn>hc.length&&(cn=hc.length),b.value=hc[cn-1]||''):" // ArrowUp "40==c?(0>--cn&&(cn=0),b.value=hc[cn-1]||''):" // ArrowDown "13==c&&(hc.length>19&&hc.pop(),hc.unshift(b.value),cn=0)" // Enter, 19 = Max number -1 of commands in history From 23495b967d6bc98efa6025ddb24100267df6ead8 Mon Sep 17 00:00:00 2001 From: Bernhard Kirchen Date: Sun, 3 Apr 2022 09:54:02 +0200 Subject: [PATCH 2/5] console cursor: remove useless spaces in JS code --- tasmota/html_compressed/HTTP_SCRIPT_CONSOL.h | 18 +++++++++--------- tasmota/html_uncompressed/HTTP_SCRIPT_CONSOL.h | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tasmota/html_compressed/HTTP_SCRIPT_CONSOL.h b/tasmota/html_compressed/HTTP_SCRIPT_CONSOL.h index e43426c6f..4a98a7b30 100644 --- a/tasmota/html_compressed/HTTP_SCRIPT_CONSOL.h +++ b/tasmota/html_compressed/HTTP_SCRIPT_CONSOL.h @@ -2,7 +2,7 @@ // compressed by tools/unishox/compress-html-uncompressed.py ///////////////////////////////////////////////////////////////////// -const size_t HTTP_SCRIPT_CONSOL_SIZE = 1046; +const size_t HTTP_SCRIPT_CONSOL_SIZE = 1043; const char HTTP_SCRIPT_CONSOL_COMPRESSED[] PROGMEM = "\x33\xBF\xAF\x71\xF0\xE3\x3A\x8B\x44\x3E\x1C\x67\x51\x18\xA3\xA8\x2A\x2B\x1A\x7C" "\x3E\x84\x3C\x18\x17\xC1\xD6\xE7\x20\x8E\xE8\xC3\xBC\x7B\x4C\xEF\xE8\x33\xAB\x0F" "\x87\xD9\xF6\x78\x0C\x27\x7F\x2A\x2B\xD1\xAF\x05\xD1\xDD\x0A\x8E\xF0\x24\xCD\x31" @@ -32,13 +32,13 @@ const char HTTP_SCRIPT_CONSOL_COMPRESSED[] PROGMEM = "\x33\xBF\xAF\x71\xF0\xE3\x "\x9F\x0F\x84\x19\xDE\x3D\xA3\x8E\x96\x2E\xB0\x3C\x1A\x30\x27\x4C\xF8\x7D\xE1\x83" "\x07\xD9\xE0\x11\xB8\x10\x04\x4C\xD0\x71\xDE\x3D\xA3\x8E\x86\x30\x31\x7E\x3B\xA7" "\x78\xF0\x38\xE9\xE7\x45\xE6\x13\x0E\xB7\x38\xBF\x7C\x3C\xCE\xE8\xE0\x41\xE3\xA0" - "\x10\xB8\xFA\x3A\x90\x24\xCC\x3B\xC7\x83\xDC\x75\x23\x8C\xEA\x3B\x84\x38\xEF\x1E" - "\x0F\x71\xCB\xF9\xF0\xF8\x41\x9D\xA3\xBA\x76\xCE\xD8\x7C\x7E\x0A\x0C\x10\xAE\x9F" - "\xA3\xF4\x77\x43\xE3\xE0\x22\x4B\x3B\xC7\x50\x21\x63\x87\xC1\x41\x9E\xF0\x7C\x75" - "\x9C\x87\xBE\x7F\x8F\xF1\xF6\x7D\x9D\xE3\xCF\x19\xF0\xF8\x41\x9D\xA3\xBA\x71\x9F" - "\x87\x59\xD6\x41\xF0\x20\xE2\x07\x19\x02\x9E\x10\x72\x59\xF0\xF8\x41\x9F\xA3\xF4" - "\x77\x41\x13\x31\x3F\x0E\x44\x7E\x8F\xD1\x0A\x0C\xE8\x33\x06\x1D\xD3\xBC\x75\x0A" - "\x0C\xE8\x2F\x81\x07\x9B\x50\x42\xC7\x0E\xF1\xD4\x1F\x1F\x0E\x33\xBC\x7B\x8E\xF1" - "\xE0\xF7\x10\xF8\x47\x74\x51\xDE\x3C\x1B"; + "\x10\xB8\xFA\x3A\x81\x26\x59\xDE\x3C\x1E\xE3\xA8\xE3\x3A\x88\x71\xDE\x3C\x1E\xE3" + "\x97\xF3\xE1\xF0\x83\x3B\x47\x74\xED\x9D\xB0\xF8\xFC\x14\x18\x21\x5B\x3F\x47\xE8" + "\xEE\x87\xC7\xC0\x44\x96\x77\x81\x0F\x1A\x3E\x0A\x0C\xF7\x83\xE3\xAC\xE4\x3D\xF3" + "\xFC\x7F\x8F\xB3\xEC\xEF\x1E\x78\xCF\x87\xC2\x0C\xED\x1D\xD3\x8C\xFC\x3A\xCE\xB2" + "\x0F\x81\x07\x10\x38\xC8\x14\xF0\x83\x92\xCF\x87\xC2\x0C\xFD\x1F\xA3\xBA\x08\x99" + "\x89\xF8\x72\x23\xF4\x7E\x88\x50\x67\x41\x98\x30\xEE\x9D\xE3\xA8\x50\x67\x41\x7C" + "\x08\x3C\xD9\x02\x16\x38\x77\x8E\xA0\xF8\xF8\x71\x9D\xE3\xDC\x77\x8F\x07\xB8\x87" + "\xC2\x3B\xA2\x8E\xF1\xE0"; #define HTTP_SCRIPT_CONSOL Decompress(HTTP_SCRIPT_CONSOL_COMPRESSED,HTTP_SCRIPT_CONSOL_SIZE).c_str() \ No newline at end of file diff --git a/tasmota/html_uncompressed/HTTP_SCRIPT_CONSOL.h b/tasmota/html_uncompressed/HTTP_SCRIPT_CONSOL.h index 543e7978f..a966adc39 100644 --- a/tasmota/html_uncompressed/HTTP_SCRIPT_CONSOL.h +++ b/tasmota/html_uncompressed/HTTP_SCRIPT_CONSOL.h @@ -49,8 +49,8 @@ const char HTTP_SCRIPT_CONSOL[] PROGMEM = "b.autocomplete='off';" // ArrowUp or ArrowDown must be a keyboard so stop browser autocomplete "setTimeout(function(b){" // for best compatibility (chrome) we need to schedule this function "b.focus();" // for best compatibility (chrome) we need to (re)focus the input element - "b.setSelectionRange(b.value.length, b.value.length);" // move cursor to the end of the command inserted from history - "}, 0, b);" + "b.setSelectionRange(b.value.length,b.value.length);" // move cursor to the end of the command inserted from history + "},0,b);" "}" "38==c?(++cn>hc.length&&(cn=hc.length),b.value=hc[cn-1]||''):" // ArrowUp "40==c?(0>--cn&&(cn=0),b.value=hc[cn-1]||''):" // ArrowDown From 5382579bff0de330a67a753952e7c885c2364b57 Mon Sep 17 00:00:00 2001 From: Bernhard Kirchen Date: Sun, 3 Apr 2022 10:04:55 +0200 Subject: [PATCH 3/5] console cursor: use absolute cursor position instead of moving the cursor to the end by using the input field value's length, we move it to position 1e9, which will certainly be beyond the end of the string. --- tasmota/html_compressed/HTTP_SCRIPT_CONSOL.h | 20 +++++++++---------- .../html_uncompressed/HTTP_SCRIPT_CONSOL.h | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tasmota/html_compressed/HTTP_SCRIPT_CONSOL.h b/tasmota/html_compressed/HTTP_SCRIPT_CONSOL.h index 4a98a7b30..e069bef65 100644 --- a/tasmota/html_compressed/HTTP_SCRIPT_CONSOL.h +++ b/tasmota/html_compressed/HTTP_SCRIPT_CONSOL.h @@ -2,7 +2,7 @@ // compressed by tools/unishox/compress-html-uncompressed.py ///////////////////////////////////////////////////////////////////// -const size_t HTTP_SCRIPT_CONSOL_SIZE = 1043; +const size_t HTTP_SCRIPT_CONSOL_SIZE = 1021; const char HTTP_SCRIPT_CONSOL_COMPRESSED[] PROGMEM = "\x33\xBF\xAF\x71\xF0\xE3\x3A\x8B\x44\x3E\x1C\x67\x51\x18\xA3\xA8\x2A\x2B\x1A\x7C" "\x3E\x84\x3C\x18\x17\xC1\xD6\xE7\x20\x8E\xE8\xC3\xBC\x7B\x4C\xEF\xE8\x33\xAB\x0F" "\x87\xD9\xF6\x78\x0C\x27\x7F\x2A\x2B\xD1\xAF\x05\xD1\xDD\x0A\x8E\xF0\x24\xCD\x31" @@ -31,14 +31,14 @@ const char HTTP_SCRIPT_CONSOL_COMPRESSED[] PROGMEM = "\x33\xBF\xAF\x71\xF0\xE3\x "\x74\x34\x66\x44\x1E\x08\xCF\x1A\x60\xEE\x9C\xBF\x9F\x0F\x84\x19\xFE\x3F\xC7\x31" "\x9F\x0F\x84\x19\xDE\x3D\xA3\x8E\x96\x2E\xB0\x3C\x1A\x30\x27\x4C\xF8\x7D\xE1\x83" "\x07\xD9\xE0\x11\xB8\x10\x04\x4C\xD0\x71\xDE\x3D\xA3\x8E\x86\x30\x31\x7E\x3B\xA7" - "\x78\xF0\x38\xE9\xE7\x45\xE6\x13\x0E\xB7\x38\xBF\x7C\x3C\xCE\xE8\xE0\x41\xE3\xA0" - "\x10\xB8\xFA\x3A\x81\x26\x59\xDE\x3C\x1E\xE3\xA8\xE3\x3A\x88\x71\xDE\x3C\x1E\xE3" - "\x97\xF3\xE1\xF0\x83\x3B\x47\x74\xED\x9D\xB0\xF8\xFC\x14\x18\x21\x5B\x3F\x47\xE8" - "\xEE\x87\xC7\xC0\x44\x96\x77\x81\x0F\x1A\x3E\x0A\x0C\xF7\x83\xE3\xAC\xE4\x3D\xF3" - "\xFC\x7F\x8F\xB3\xEC\xEF\x1E\x78\xCF\x87\xC2\x0C\xED\x1D\xD3\x8C\xFC\x3A\xCE\xB2" - "\x0F\x81\x07\x10\x38\xC8\x14\xF0\x83\x92\xCF\x87\xC2\x0C\xFD\x1F\xA3\xBA\x08\x99" - "\x89\xF8\x72\x23\xF4\x7E\x88\x50\x67\x41\x98\x30\xEE\x9D\xE3\xA8\x50\x67\x41\x7C" - "\x08\x3C\xD9\x02\x16\x38\x77\x8E\xA0\xF8\xF8\x71\x9D\xE3\xDC\x77\x8F\x07\xB8\x87" - "\xC2\x3B\xA2\x8E\xF1\xE0"; + "\x78\xF0\x38\xE9\xE7\x45\xE6\x13\x0E\xB7\x38\xBF\x7C\x3C\xCE\xE9\xC8\x4C\xE2\x3A" + "\xA1\x33\x88\xEF\x1E\x0F\x71\xD4\xCE\xA2\x1C\x77\x8F\x07\xB8\xE5\xFC\xF8\x7C\x20" + "\xCE\xD1\xDD\x3B\x67\x6C\x3E\x3F\x05\x06\x08\x5C\x89\x1F\xA3\xF4\x77\x43\xE3\xE0" + "\x22\x4B\x3B\xC7\x50\xE0\x42\xE5\x18\x50\x67\xBC\x1F\x1D\x67\x21\xEF\x9F\xE3\xFC" + "\x7D\x9F\x67\x78\xF3\xC6\x7C\x3E\x10\x67\x68\xEE\x9C\x67\xE1\xD6\x75\x90\x7C\x08" + "\x38\x81\xC6\x40\xA7\x84\x1C\x96\x7C\x3E\x10\x67\xE8\xFD\x1D\xD0\x44\xCC\x4F\xC3" + "\x91\x1F\xA3\xF4\x42\x83\x3A\x0C\xC1\x87\x74\xEF\x1D\x42\x83\x3A\x0B\xE0\x41\xE6" + "\x70\x10\xB1\xC3\xBC\x75\x07\xC7\xC3\x8C\xEF\x1E\xE3\xBC\x78\x3D\xC4\x3E\x11\xDD" + "\x14\x77\x8F\x06"; #define HTTP_SCRIPT_CONSOL Decompress(HTTP_SCRIPT_CONSOL_COMPRESSED,HTTP_SCRIPT_CONSOL_SIZE).c_str() \ No newline at end of file diff --git a/tasmota/html_uncompressed/HTTP_SCRIPT_CONSOL.h b/tasmota/html_uncompressed/HTTP_SCRIPT_CONSOL.h index a966adc39..05ba67e48 100644 --- a/tasmota/html_uncompressed/HTTP_SCRIPT_CONSOL.h +++ b/tasmota/html_uncompressed/HTTP_SCRIPT_CONSOL.h @@ -49,7 +49,7 @@ const char HTTP_SCRIPT_CONSOL[] PROGMEM = "b.autocomplete='off';" // ArrowUp or ArrowDown must be a keyboard so stop browser autocomplete "setTimeout(function(b){" // for best compatibility (chrome) we need to schedule this function "b.focus();" // for best compatibility (chrome) we need to (re)focus the input element - "b.setSelectionRange(b.value.length,b.value.length);" // move cursor to the end of the command inserted from history + "b.setSelectionRange(1e9,1e9);" // move cursor to the end (hopefully) of the command inserted from history "},0,b);" "}" "38==c?(++cn>hc.length&&(cn=hc.length),b.value=hc[cn-1]||''):" // ArrowUp From 7ac91d4e341e7184d25116ed06689f151ce0293b Mon Sep 17 00:00:00 2001 From: Bernhard Kirchen Date: Sun, 3 Apr 2022 10:16:55 +0200 Subject: [PATCH 4/5] console cursor: use lambda function --- tasmota/html_compressed/HTTP_SCRIPT_CONSOL.h | 22 +++++++++---------- .../html_uncompressed/HTTP_SCRIPT_CONSOL.h | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tasmota/html_compressed/HTTP_SCRIPT_CONSOL.h b/tasmota/html_compressed/HTTP_SCRIPT_CONSOL.h index e069bef65..017317db0 100644 --- a/tasmota/html_compressed/HTTP_SCRIPT_CONSOL.h +++ b/tasmota/html_compressed/HTTP_SCRIPT_CONSOL.h @@ -2,7 +2,7 @@ // compressed by tools/unishox/compress-html-uncompressed.py ///////////////////////////////////////////////////////////////////// -const size_t HTTP_SCRIPT_CONSOL_SIZE = 1021; +const size_t HTTP_SCRIPT_CONSOL_SIZE = 1013; const char HTTP_SCRIPT_CONSOL_COMPRESSED[] PROGMEM = "\x33\xBF\xAF\x71\xF0\xE3\x3A\x8B\x44\x3E\x1C\x67\x51\x18\xA3\xA8\x2A\x2B\x1A\x7C" "\x3E\x84\x3C\x18\x17\xC1\xD6\xE7\x20\x8E\xE8\xC3\xBC\x7B\x4C\xEF\xE8\x33\xAB\x0F" "\x87\xD9\xF6\x78\x0C\x27\x7F\x2A\x2B\xD1\xAF\x05\xD1\xDD\x0A\x8E\xF0\x24\xCD\x31" @@ -30,15 +30,15 @@ const char HTTP_SCRIPT_CONSOL_COMPRESSED[] PROGMEM = "\x33\xBF\xAF\x71\xF0\xE3\x "\x09\x83\xFC\x7D\x9D\x40\x89\xC7\xF3\x04\x1E\x37\x07\x02\x27\x38\xA7\x50\x67\xC6" "\x74\x34\x66\x44\x1E\x08\xCF\x1A\x60\xEE\x9C\xBF\x9F\x0F\x84\x19\xFE\x3F\xC7\x31" "\x9F\x0F\x84\x19\xDE\x3D\xA3\x8E\x96\x2E\xB0\x3C\x1A\x30\x27\x4C\xF8\x7D\xE1\x83" - "\x07\xD9\xE0\x11\xB8\x10\x04\x4C\xD0\x71\xDE\x3D\xA3\x8E\x86\x30\x31\x7E\x3B\xA7" - "\x78\xF0\x38\xE9\xE7\x45\xE6\x13\x0E\xB7\x38\xBF\x7C\x3C\xCE\xE9\xC8\x4C\xE2\x3A" - "\xA1\x33\x88\xEF\x1E\x0F\x71\xD4\xCE\xA2\x1C\x77\x8F\x07\xB8\xE5\xFC\xF8\x7C\x20" - "\xCE\xD1\xDD\x3B\x67\x6C\x3E\x3F\x05\x06\x08\x5C\x89\x1F\xA3\xF4\x77\x43\xE3\xE0" - "\x22\x4B\x3B\xC7\x50\xE0\x42\xE5\x18\x50\x67\xBC\x1F\x1D\x67\x21\xEF\x9F\xE3\xFC" - "\x7D\x9F\x67\x78\xF3\xC6\x7C\x3E\x10\x67\x68\xEE\x9C\x67\xE1\xD6\x75\x90\x7C\x08" - "\x38\x81\xC6\x40\xA7\x84\x1C\x96\x7C\x3E\x10\x67\xE8\xFD\x1D\xD0\x44\xCC\x4F\xC3" - "\x91\x1F\xA3\xF4\x42\x83\x3A\x0C\xC1\x87\x74\xEF\x1D\x42\x83\x3A\x0B\xE0\x41\xE6" - "\x70\x10\xB1\xC3\xBC\x75\x07\xC7\xC3\x8C\xEF\x1E\xE3\xBC\x78\x3D\xC4\x3E\x11\xDD" - "\x14\x77\x8F\x06"; + "\x07\xD9\xE0\x11\xB8\x10\x1C\x7C\x3F\x0F\x68\xE3\xA1\x8C\x0C\x5F\x8E\xE9\xDE\x3C" + "\x0E\x3A\x79\xD1\x79\x84\xC3\xAD\xCE\x2F\xDF\x0F\x33\xBA\x72\x13\x38\x8E\xA8\x4C" + "\xE2\x3B\xC7\x83\xDC\x75\x33\xA8\x87\x1D\xE3\xC1\xEE\x39\x7F\x3E\x1F\x08\x33\xB4" + "\x77\x4E\xD9\xDB\x0F\x8F\xC1\x41\x82\x17\x21\x47\xE8\xFD\x1D\xD0\xF8\xF8\x08\x92" + "\xCE\xF1\xD4\x38\x10\xB9\x3E\x14\x19\xEF\x07\xC7\x59\xC8\x7B\xE7\xF8\xFF\x1F\x67" + "\xD9\xDE\x3C\xF1\x9F\x0F\x84\x19\xDA\x3B\xA7\x19\xF8\x75\x9D\x64\x1F\x02\x0E\x20" + "\x71\x90\x29\xE1\x07\x25\x9F\x0F\x84\x19\xFA\x3F\x47\x74\x11\x33\x13\xF0\xE4\x47" + "\xE8\xFD\x10\xA0\xCE\x83\x30\x61\xDD\x3B\xC7\x50\xA0\xCE\x82\xF8\x10\x79\x94\x04" + "\x2C\x70\xEF\x1D\x41\xF1\xF0\xE3\x3B\xC7\xB8\xEF\x1E\x0F\x71\x0F\x84\x77\x45\x1D" + "\xE3\xC1"; #define HTTP_SCRIPT_CONSOL Decompress(HTTP_SCRIPT_CONSOL_COMPRESSED,HTTP_SCRIPT_CONSOL_SIZE).c_str() \ No newline at end of file diff --git a/tasmota/html_uncompressed/HTTP_SCRIPT_CONSOL.h b/tasmota/html_uncompressed/HTTP_SCRIPT_CONSOL.h index 05ba67e48..1cd7341d4 100644 --- a/tasmota/html_uncompressed/HTTP_SCRIPT_CONSOL.h +++ b/tasmota/html_uncompressed/HTTP_SCRIPT_CONSOL.h @@ -47,7 +47,7 @@ const char HTTP_SCRIPT_CONSOL[] PROGMEM = "var b=eb('c1'),c=e.keyCode;" // c1 = Console command id "if(38==c||40==c){" // ArrowUp or ArrowDown "b.autocomplete='off';" // ArrowUp or ArrowDown must be a keyboard so stop browser autocomplete - "setTimeout(function(b){" // for best compatibility (chrome) we need to schedule this function + "setTimeout(b=>{" // for best compatibility (chrome) we need to schedule this function "b.focus();" // for best compatibility (chrome) we need to (re)focus the input element "b.setSelectionRange(1e9,1e9);" // move cursor to the end (hopefully) of the command inserted from history "},0,b);" From c9f428a4f6b4f8b0010249ec94caba2f432063c5 Mon Sep 17 00:00:00 2001 From: Bernhard Kirchen Date: Sun, 3 Apr 2022 10:56:54 +0200 Subject: [PATCH 5/5] console cursor: remove useless semicolons in JS code --- tasmota/html_compressed/HTTP_SCRIPT_CONSOL.h | 17 ++++++++--------- tasmota/html_uncompressed/HTTP_SCRIPT_CONSOL.h | 4 ++-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/tasmota/html_compressed/HTTP_SCRIPT_CONSOL.h b/tasmota/html_compressed/HTTP_SCRIPT_CONSOL.h index 017317db0..25ffc036d 100644 --- a/tasmota/html_compressed/HTTP_SCRIPT_CONSOL.h +++ b/tasmota/html_compressed/HTTP_SCRIPT_CONSOL.h @@ -2,7 +2,7 @@ // compressed by tools/unishox/compress-html-uncompressed.py ///////////////////////////////////////////////////////////////////// -const size_t HTTP_SCRIPT_CONSOL_SIZE = 1013; +const size_t HTTP_SCRIPT_CONSOL_SIZE = 1011; const char HTTP_SCRIPT_CONSOL_COMPRESSED[] PROGMEM = "\x33\xBF\xAF\x71\xF0\xE3\x3A\x8B\x44\x3E\x1C\x67\x51\x18\xA3\xA8\x2A\x2B\x1A\x7C" "\x3E\x84\x3C\x18\x17\xC1\xD6\xE7\x20\x8E\xE8\xC3\xBC\x7B\x4C\xEF\xE8\x33\xAB\x0F" "\x87\xD9\xF6\x78\x0C\x27\x7F\x2A\x2B\xD1\xAF\x05\xD1\xDD\x0A\x8E\xF0\x24\xCD\x31" @@ -32,13 +32,12 @@ const char HTTP_SCRIPT_CONSOL_COMPRESSED[] PROGMEM = "\x33\xBF\xAF\x71\xF0\xE3\x "\x9F\x0F\x84\x19\xDE\x3D\xA3\x8E\x96\x2E\xB0\x3C\x1A\x30\x27\x4C\xF8\x7D\xE1\x83" "\x07\xD9\xE0\x11\xB8\x10\x1C\x7C\x3F\x0F\x68\xE3\xA1\x8C\x0C\x5F\x8E\xE9\xDE\x3C" "\x0E\x3A\x79\xD1\x79\x84\xC3\xAD\xCE\x2F\xDF\x0F\x33\xBA\x72\x13\x38\x8E\xA8\x4C" - "\xE2\x3B\xC7\x83\xDC\x75\x33\xA8\x87\x1D\xE3\xC1\xEE\x39\x7F\x3E\x1F\x08\x33\xB4" - "\x77\x4E\xD9\xDB\x0F\x8F\xC1\x41\x82\x17\x21\x47\xE8\xFD\x1D\xD0\xF8\xF8\x08\x92" - "\xCE\xF1\xD4\x38\x10\xB9\x3E\x14\x19\xEF\x07\xC7\x59\xC8\x7B\xE7\xF8\xFF\x1F\x67" - "\xD9\xDE\x3C\xF1\x9F\x0F\x84\x19\xDA\x3B\xA7\x19\xF8\x75\x9D\x64\x1F\x02\x0E\x20" - "\x71\x90\x29\xE1\x07\x25\x9F\x0F\x84\x19\xFA\x3F\x47\x74\x11\x33\x13\xF0\xE4\x47" - "\xE8\xFD\x10\xA0\xCE\x83\x30\x61\xDD\x3B\xC7\x50\xA0\xCE\x82\xF8\x10\x79\x94\x04" - "\x2C\x70\xEF\x1D\x41\xF1\xF0\xE3\x3B\xC7\xB8\xEF\x1E\x0F\x71\x0F\x84\x77\x45\x1D" - "\xE3\xC1"; + "\xE2\x3B\xC7\xB8\xEA\x67\x51\x0E\x3B\xC7\xB8\xE5\xFC\xF8\x7C\x20\xCE\xD1\xDD\x3B" + "\x67\x6C\x3E\x3F\x05\x06\x08\x5C\x84\x1F\xA3\xF4\x77\x43\xE3\xE0\x22\x4B\x3B\xC7" + "\x50\xE0\x42\xE4\xF0\x50\x67\xBC\x1F\x1D\x67\x21\xEF\x9F\xE3\xFC\x7D\x9F\x67\x78" + "\xF3\xC6\x7C\x3E\x10\x67\x68\xEE\x9C\x67\xE1\xD6\x75\x90\x7C\x08\x38\x81\xC6\x40" + "\xA7\x84\x1C\x96\x7C\x3E\x10\x67\xE8\xFD\x1D\xD0\x44\xCC\x4F\xC3\x91\x1F\xA3\xF4" + "\x42\x83\x3A\x0C\xC1\x87\x74\xEF\x1D\x42\x83\x3A\x0B\xE0\x41\xE6\x48\x10\xB1\xC3" + "\xBC\x75\x07\xC7\xC3\x8C\xEF\x1E\xE3\xBC\x78\x3D\xC4\x3E\x11\xDD\x14\x77\x8F\x06"; #define HTTP_SCRIPT_CONSOL Decompress(HTTP_SCRIPT_CONSOL_COMPRESSED,HTTP_SCRIPT_CONSOL_SIZE).c_str() \ No newline at end of file diff --git a/tasmota/html_uncompressed/HTTP_SCRIPT_CONSOL.h b/tasmota/html_uncompressed/HTTP_SCRIPT_CONSOL.h index 1cd7341d4..d7c83c085 100644 --- a/tasmota/html_uncompressed/HTTP_SCRIPT_CONSOL.h +++ b/tasmota/html_uncompressed/HTTP_SCRIPT_CONSOL.h @@ -49,8 +49,8 @@ const char HTTP_SCRIPT_CONSOL[] PROGMEM = "b.autocomplete='off';" // ArrowUp or ArrowDown must be a keyboard so stop browser autocomplete "setTimeout(b=>{" // for best compatibility (chrome) we need to schedule this function "b.focus();" // for best compatibility (chrome) we need to (re)focus the input element - "b.setSelectionRange(1e9,1e9);" // move cursor to the end (hopefully) of the command inserted from history - "},0,b);" + "b.setSelectionRange(1e9,1e9)" // move cursor to the end (hopefully) of the command inserted from history + "},0,b)" "}" "38==c?(++cn>hc.length&&(cn=hc.length),b.value=hc[cn-1]||''):" // ArrowUp "40==c?(0>--cn&&(cn=0),b.value=hc[cn-1]||''):" // ArrowDown