Repository navigation
fix(js): keep dialog.pickFile() open until the user selects - #3094
Open
sergarsilla wants to merge 1 commit into
Open
sergarsilla wants to merge 1 commit into
sergarsilla wants to merge 1 commit into
Conversation
native_dialogPickFile() calls loopSD(), which ran its file-list loopOptions() with interpreter=false. While the JS interpreter is running (interpreter_state > 0), loopOptions() breaks out of its input loop immediately when that flag is false, so loopSD() kept the default index and returned the first file without any user interaction. Thread an `interpreter` flag through loopSD() (default false, so every existing caller is unchanged) and forward it to the file-list loopOptions() call. dialog.pickFile() now passes true, keeping the picker open until the user selects a file or cancels. Fixes BruceDevices#3084
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
dialog.pickFile()in the JS interpreter returns the first file immediately instead of waiting for the user to choose.native_dialogPickFile()callsloopSD(), which runs its file-listloopOptions()withinterpreter = false. While the interpreter is running (interpreter_state > 0),loopOptions()breaks out of its input loop immediately when that flag is false, soloopSD()kept the default index (0) and returned the first file without any user interaction.This threads an
interpreterflag throughloopSD()(defaulting tofalse, so every existing caller is unchanged) and forwards it to the file-listloopOptions()call.dialog.pickFile()now passestrue, keeping the picker open until the user selects a file or cancels.Types of Changes
Bugfix
Verification
Run a script that calls
dialog.pickFile("/", "*"): the file browser now stays open until a file is selected (returns the path) or the user cancels (returns ""), instead of returning the first entry instantly. Matches the original report using the Key Decoding app's "Load" menu on a T-Embed CC1101.Testing
Builds clean for
lilygo-t-embed-cc1101. Manually verifiable on-device as above; no automated test added (interactive menu/UI code without existing unit-test coverage).Linked Issues
Fixes #3084
User-Facing Change
```release-note
Fix dialog.pickFile() in the JS interpreter returning the first file instead of waiting for a selection.
```
Further Comments
Minimal, scoped change. The same early-break also affects the long-press action sub-menus inside
loopSD()(rename/delete/new-folder) when invoked from the interpreter; left as-is since they're outside the reported file-picking flow and could be a follow-up.