esp32tool 1.6.3 → 1.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/icons/icon-72.png CHANGED
Binary file
package/icons/icon-96.png CHANGED
Binary file
package/index.html CHANGED
@@ -370,6 +370,7 @@
370
370
  Program
371
371
  </button>
372
372
  </div>
373
+ <div class="progress-bar hidden indeterminate" id="eraseProgress"><div></div></div>
373
374
  <div class="partition-table">
374
375
  <button id="butReadPartitions" type="button" disabled="disabled">
375
376
  Read Partition Table
package/js/console.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { ColoredConsole, coloredConsoleStyles } from "./util/console-color.js";
2
2
  import { LineBreakTransformer } from "./util/line-break-transformer.js";
3
+ import { TimestampTransformer } from "./util/timestamp-transformer.js";
3
4
  import { ImprovDialog } from "./improv.js";
4
5
 
5
6
  export class ESP32ToolConsole {
@@ -16,6 +17,11 @@ export class ESP32ToolConsole {
16
17
  this.allowInput = allowInput;
17
18
  this.console = null;
18
19
  this.cancelConnection = null;
20
+ // Command history buffer — keep in sync with src/console.ts
21
+ // (history logic is duplicated there; update both files together)
22
+ this.commandHistory = [];
23
+ this.historyIndex = -1;
24
+ this.currentInput = "";
19
25
  }
20
26
 
21
27
  logs() {
@@ -180,6 +186,16 @@ export class ESP32ToolConsole {
180
186
  ev.preventDefault();
181
187
  ev.stopPropagation();
182
188
  this._sendCommand();
189
+ } else if (ev.key === "ArrowUp") {
190
+ ev.preventDefault();
191
+ this._navigateHistory(1, input);
192
+ } else if (ev.key === "ArrowDown") {
193
+ ev.preventDefault();
194
+ this._navigateHistory(-1, input);
195
+ } else {
196
+ if (this.historyIndex !== -1) {
197
+ this.historyIndex = -1;
198
+ }
183
199
  }
184
200
  });
185
201
  }
@@ -220,16 +236,16 @@ export class ESP32ToolConsole {
220
236
  signal: abortSignal,
221
237
  })
222
238
  .pipeThrough(new TransformStream(new LineBreakTransformer()))
239
+ .pipeThrough(new TransformStream(new TimestampTransformer()))
223
240
  .pipeTo(
224
241
  new WritableStream({
225
242
  write: (chunk) => {
226
- const cleaned = chunk.replace(/\r\n$/, "\n");
227
- this.console.addLine(cleaned);
243
+ this.console.addLine(chunk);
228
244
 
229
245
  if (!bootloaderDetected && lineCount < 30) {
230
246
  lineCount++;
231
247
  for (const pat of BOOTLOADER_PATTERNS) {
232
- if (pat.test(cleaned)) {
248
+ if (pat.test(chunk)) {
233
249
  bootloaderDetected = true;
234
250
  this.containerElement.dispatchEvent(
235
251
  new CustomEvent("console-bootloader", { bubbles: true })
@@ -259,9 +275,42 @@ export class ESP32ToolConsole {
259
275
  }
260
276
  }
261
277
 
278
+ _navigateHistory(direction, input) {
279
+ if (this.commandHistory.length === 0) return;
280
+
281
+ if (this.historyIndex === -1) {
282
+ this.currentInput = input.value;
283
+ }
284
+
285
+ const nextIndex = this.historyIndex + direction;
286
+
287
+ if (nextIndex < 0) {
288
+ this.historyIndex = -1;
289
+ input.value = this.currentInput;
290
+ } else if (nextIndex < this.commandHistory.length) {
291
+ this.historyIndex = nextIndex;
292
+ input.value = this.commandHistory[this.historyIndex];
293
+ }
294
+
295
+ const len = input.value.length;
296
+ input.setSelectionRange(len, len);
297
+ }
298
+
262
299
  async _sendCommand() {
263
300
  const input = this.containerElement.querySelector(".esp32tool-console-input");
264
301
  const command = input.value;
302
+
303
+ if (command.trim() !== "") {
304
+ if (this.commandHistory[0] !== command) {
305
+ this.commandHistory.unshift(command);
306
+ if (this.commandHistory.length > 100) {
307
+ this.commandHistory.pop();
308
+ }
309
+ }
310
+ }
311
+ this.historyIndex = -1;
312
+ this.currentInput = "";
313
+
265
314
  if (!this.port.writable) {
266
315
  this.console.addLine("Terminal disconnected: port not writable");
267
316
  return;