Skip to content

Commit 6197aec

Browse files
committed
fix: board navigation path, REPL resize handle.
Signed-off-by: ubi de feo <me@ubidefeo.com>
1 parent ab945b4 commit 6197aec

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

ui/arduino/store.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,10 @@ async function store(state, emitter) {
478478
emitter.on('start-resizing-panel', () => {
479479
// log('start-resizing-panel')
480480
window.addEventListener('mousemove', state.resizePanel)
481-
// Stop resizing when mouse leaves window or enters the tabs area
481+
// Stop resizing when mouse button is released anywhere, leaves window, or enters the tabs area
482+
window.addEventListener('mouseup', () => {
483+
emitter.emit('stop-resizing-panel')
484+
}, { once: true })
482485
document.body.addEventListener('mouseleave', () => {
483486
emitter.emit('stop-resizing-panel')
484487
}, { once: true })
@@ -1454,7 +1457,7 @@ async function store(state, emitter) {
14541457
const fileContent = await serialBridge.loadFile(
14551458
serialBridge.getFullPath(
14561459
state.boardNavigationRoot,
1457-
state.boardNavigationPath,
1460+
selectedFile.parentFolder,
14581461
selectedFile.fileName
14591462
),
14601463
(progress) => {
@@ -1467,7 +1470,7 @@ async function store(state, emitter) {
14671470
// we feed the Uint8Array to the TextDecoder
14681471
const bytesToSource = new TextDecoder('utf-8').decode(contentArray);
14691472
file = createFile({
1470-
parentFolder: state.boardNavigationPath,
1473+
parentFolder: selectedFile.parentFolder,
14711474
fileName: selectedFile.fileName,
14721475
source: selectedFile.source,
14731476
content: bytesToSource
@@ -1480,12 +1483,12 @@ async function store(state, emitter) {
14801483
const fileContent = await disk.loadFile(
14811484
disk.getFullPath(
14821485
state.diskNavigationRoot,
1483-
state.diskNavigationPath,
1486+
selectedFile.parentFolder,
14841487
selectedFile.fileName
14851488
)
14861489
)
14871490
file = createFile({
1488-
parentFolder: state.diskNavigationPath,
1491+
parentFolder: selectedFile.parentFolder,
14891492
fileName: selectedFile.fileName,
14901493
source: selectedFile.source,
14911494
content: fileContent
@@ -1517,6 +1520,8 @@ async function store(state, emitter) {
15171520
state.selectedFiles = []
15181521
state.view = 'editor'
15191522
updateMenu()
1523+
} catch (e) {
1524+
await alertError(state, emitter, e, 'Failed to open file')
15201525
} finally {
15211526
state.overlay = null
15221527
state.isLoadingFiles = false
@@ -1609,7 +1614,7 @@ async function store(state, emitter) {
16091614
const file = state.selectedFiles[i]
16101615
const srcPath = disk.getFullPath(
16111616
state.diskNavigationRoot,
1612-
state.diskNavigationPath,
1617+
file.parentFolder,
16131618
file.fileName
16141619
)
16151620
const destPath = serialBridge.getFullPath(
@@ -1695,7 +1700,7 @@ async function store(state, emitter) {
16951700
const file = state.selectedFiles[i]
16961701
const srcPath = serialBridge.getFullPath(
16971702
state.boardNavigationRoot,
1698-
state.boardNavigationPath,
1703+
file.parentFolder,
16991704
file.fileName
17001705
)
17011706
const destPath = disk.getFullPath(
@@ -1746,6 +1751,7 @@ async function store(state, emitter) {
17461751
})
17471752
emitter.on('navigate-board-parent', () => {
17481753
// log('navigate-board-parent')
1754+
if (terminalRouter) terminalRouter.setOperation('directory-navigation')
17491755
state.boardNavigationPath = serialBridge.getNavigationPath(
17501756
state.boardNavigationPath,
17511757
'..'

0 commit comments

Comments
 (0)