-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Fix status bar custom board preferences disappearing #11200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've noticed this issue before, good to see it fixed.
Looking at the code, this looks like a reasonable fix. Haven't tested, though.
One thing that might improve this could be to remove the duplicate code entirely, for example by adding a updateBoardAndPort()
method to EditorLineStatus
that can be called from both onBoardOrPortChange
and paintComponent
(the latter within the existing if).
I've noticed this issue before, good to see it fixed.
Looking at the code, this looks like a reasonable fix. Haven't tested, though.
One thing that might improve this could be to remove the duplicate code entirely, for example by adding a
updateBoardAndPort()
method toEditorLineStatus
that can be called from bothonBoardOrPortChange
andpaintComponent
(the latter within the existing if).
Thanks for the feedback.
The solution you are describing seems like the better option, but the reason I leaned towards this "dirty" fix is because having dealt with Arduino IDE code before, I found that keeping modifications to a minimum usually produces less bugs in the long run.
That being said, I think the reason this bug existed in the first place is because of the duplicated code, the feature was implemented in one place but not the other. So it makes more sense to get rid of the root of the problem to avoid it happening again. I'll just have to be more careful and mind any other "board changes" that might be happening somewhere else.
I'll try it out and update this pull request with the new fix.
86d66f4
to
5e75194
Compare
This is turned out easier than I expected as I found that only the Editor deals with EditorLineStatus.
As per the contribution guidelines, I rebased the commit and made a force push in the fork to update the pull request instead of adding new commits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks perfect to me!
LGTM!
This commit fixes #11164
The cause of the bug was that although EditorLineStatus' "paintComponent" function correctly calls "getBoardPreferences" which accounts for any custom board preferences, Editor's "onBoardOrPortChange" incorrectly calls "getTargetBoard" which only account for the board name.
That's why the board settings appear at first but any change to the board settings makes them disappear.
My fix was to simply call "getBoardPreferences" in Editor's "onBoardOrPortChange" just like the implementation in EditorLineStatus.
All Submissions:
Changes to Core Features: