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

[Bug] File provider pop-up dialog stacks with multiple external file changes #1645

Open
1 task done
SparkyTD opened this issue Apr 30, 2024 · 0 comments
Open
1 task done
Labels
bug Something isn't working

Comments

@SparkyTD
Copy link
Contributor

SparkyTD commented Apr 30, 2024

Operating System

Windows

What's the issue you encountered?

The built-in File provider detects external changes to an open file and prompts the user to reload the file with a pop-up dialog. The issue is that if the file undergoes multiple changes in a row before the user can respond to the initial pop-up, additional dialogs will stack up, requiring the user to confirm or dismiss each one individually. This can be very annoying if the file changes multiple times.

How can the issue be reproduced?

  1. Create a text file and write some text in it
  2. Open the file in both ImHex and Notepad
  3. In Notepad, make three different changes to the file, making sure to save after each change
  4. In ImHex, the "File has been modified" dialog will appear three times in a row, and you'll have to press "Yes" or "No" on all three.

ImHex Version

1.33.0 (master@ef99e9d)

ImHex Build Type

  • Nightly or built from sources

Installation type

MSI

Additional context?

Here are two possible solutions:

  1. Add an option to auto-reload when the window is focused, with no dialog (like HxD, I would personally prefer this one)
  2. Consolidate multiple changes into a single dialog that reloads the latest change (like Notepad++)
@SparkyTD SparkyTD added the bug Something isn't working label Apr 30, 2024
WerWolv pushed a commit that referenced this issue May 7, 2024
<!--
Please provide as much information as possible about what your PR aims
to do.
PRs with no description will most likely be closed until more
information is provided.
If you're planing on changing fundamental behaviour or add big new
features, please open a GitHub Issue first before starting to work on
it.
If it's not something big and you still want to contact us about it,
feel free to do so !
-->

### Problem description
This PR aims to address #1645 that caused the built in file provider's
change monitor to trigger the notification popup dialog multiple times
in a row after multiple external file changes.

### Implementation description
I added an additional boolean field
`m_changeEventAcknowledgementPending` that tracks whether there are any
pending or unacknowledged change notification dialogs to prevent further
dialogs from being opened. The flag is only reset to its initial value
once the user has acknowledged the first `PopupQuestion` dialog.

Since the file is reloaded only after the user clicks 'Yes', it is
unnecessary to ensure that only the latest popup is acknowledged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant