Skip to content
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

IOWindow: Do not accept on syntax errors #10131

Merged
merged 2 commits into from Oct 5, 2021

Conversation

malleoz
Copy link
Contributor

@malleoz malleoz commented Sep 27, 2021

In the current Dolphin dev, typing anything into a hotkey formula box and clicking OK would prompt you with a syntax error window, only for your gibberish to be accepted as input. After closing out of the error window, your change would be applied and the formula window would close.

This PR fixes two issues, the latter of which is only exposed when the former is fixed.

  1. Do not accept on hotkey syntax errors
  • Pressing okay on the warning window when receiving a syntax error will still call accept() in the IOWindow. Thus, your syntactically incorrect changes will still be applied.
  1. Do not overwrite hotkey config on window close
  • With step 1 resolved, this then exposes the issue where the hotkey expression is already updated by the point that you hit "OK', regardless of whether or not there was a syntax issue. Closing the window after this point would still overwrite your expression with whatever gibberish you just entered. So the second commit moves the m_original_expression update so that it only updates when a syntax error does not occur.

Before:
https://i.imgur.com/SgWm6AW.mp4

After:
https://i.imgur.com/lcHY8fK.mp4

Previously you could type whatever gibberish you wanted into the formula bar, press OK, and receive a modal syntax error window. Closing the syntax error window would cause the hotkey config window to close as well, and your gibberish would be applied to the hotkey assignment.

This commit requires that a syntax error does not occur before accept() is called.
If this commit is not applied, then the previous commit will cause hotkeys to be saved if there is a syntax error when hitting "OK" and the user presses the X to close the window.

This commit only applies changes to hotkey config if no syntax error occurs.
@leoetlino leoetlino merged commit bf6a278 into dolphin-emu:master Oct 5, 2021
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants