diff --git a/index.html b/index.html index c136623..26db8e2 100644 --- a/index.html +++ b/index.html @@ -96,6 +96,7 @@
+
diff --git a/js/common/file_dialog.js b/js/common/file_dialog.js index 319247f..3e05266 100644 --- a/js/common/file_dialog.js +++ b/js/common/file_dialog.js @@ -291,8 +291,9 @@ class FileDialog extends GenericModal { } else if (clickedItem.getAttribute("data-type") != "folder") { this._getElement('fileNameField').value = clickedItem.querySelector("span").innerHTML; } - - this._lastSelectedNode = clickedItem; + if (this._lastSelectedNode == null || !modifierKeys.includes(MODIFIER_SHIFT)) { + this._lastSelectedNode = clickedItem; + } this._setElementEnabled('okButton', !this._multipleItemsSelected() && clickedItem.getAttribute("data-type") != "bin"); this._updateToolbar(); } diff --git a/js/layout.js b/js/layout.js index bad77da..8323a67 100644 --- a/js/layout.js +++ b/js/layout.js @@ -139,7 +139,6 @@ function refitTerminal() { if (xterm_screen) { let cols = Math.floor(terminalWidth / TERMINAL_COL_WIDTH); let rows = Math.floor(terminalHeight / TERMINAL_ROW_HEIGHT); - console.log(rows, cols, terminalHeight, terminalWidth, TERMINAL_ROW_HEIGHT, TERMINAL_COL_WIDTH); if (cols < MINIMUM_COLS) { cols = MINIMUM_COLS; } diff --git a/js/script.js b/js/script.js index f18886d..6b32d71 100644 --- a/js/script.js +++ b/js/script.js @@ -33,6 +33,7 @@ let unchanged = 0; let connectionPromise = null; const btnRestart = document.querySelector('.btn-restart'); +const btnHalt = document.querySelector('.btn-halt'); const btnPlotter = document.querySelector('.btn-plotter'); const btnClear = document.querySelector('.btn-clear'); const btnConnect = document.querySelectorAll('.btn-connect'); @@ -130,6 +131,14 @@ btnRestart.addEventListener('click', async function(e) { } }); +// Halt Button +btnHalt.addEventListener('click', async function(e) { + if (await checkConnected()) { + // Perform a device soft halt + await workflow.haltScript(); + } +}); + // Clear Button btnClear.addEventListener('click', async function(e) { if (workflow.plotterChart){ diff --git a/js/workflows/ble.js b/js/workflows/ble.js index bf020fc..c2ad323 100644 --- a/js/workflows/ble.js +++ b/js/workflows/ble.js @@ -253,9 +253,14 @@ class BLEWorkflow extends Workflow { } // Is this a new connection? if (!this.bleDevice) { - let devices = await navigator.bluetooth.getDevices(); - for (const device of devices) { - await this.connectToBluetoothDevice(device); + try { + let devices = await navigator.bluetooth.getDevices(); + for (const device of devices) { + await this.connectToBluetoothDevice(device); + } + } catch (error) { + console.error(error); + this.showConnectStatus(this._suggestBLEConnectActions(error)); } } } diff --git a/js/workflows/workflow.js b/js/workflows/workflow.js index 30bf7e1..33c7ada 100644 --- a/js/workflows/workflow.js +++ b/js/workflows/workflow.js @@ -91,7 +91,11 @@ class Workflow { } async restartDevice() { - this.repl.softRestart(); + await this.repl.softRestart(); + } + + async haltScript() { + await this.repl.interruptCode(); } makeDocState(document, docChangePos) {