[BBD] Keyword assignment gets canceled

Started by banzai, June 14, 2023, 09:29:57 PM

Previous topic - Next topic

banzai

Not a big issue, but something I noticed yesterday:

- I have a file selected in the file window and the "Keywords" panel open.
- I click on a keyword from the "Recent" tab => Keyword is added, Checkmark and X icons get highlighted, just as expected.
- Now I open the thesaurus manager from the toolbar of the Keywords panel and close it right away with the OK button.

=> The just added keyword is gone, both icons are greyed out again, just like when canceling (clicking X icon).

Ciao,  banzai.
PS: this happens also in IMatch 2021 (in fact I wanted to report this yesterday, then saw the announcement and wanted to check 2023 first :) )

Mario

I would consider this behavior by design. Closing the thesaurus manager forces a reload of many things, including the file window.

Just don't do this. Commit your changes before opening the thesaurus manager.
I don't know how often you personally do this, but this behavior is unchanged since IMatch 5.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

banzai

When I'm adding keywords I sometimes notice that something is missing in my thesaurus and I quickly open it to fix this.
I will try to make it a habit to commit first. As I said, it's not a big issue, just came surprising when my edits where suddenly gone.

Mario

When the user opens the Thesaurus Manager and closes it with OK, he can have changed many things. The Keyword Panel has no way to track changes done to the thesaurus in the database.

It has to completely rebuild itself when it receives notice of changes made to the thesaurus, load the layout to ensure that all sub-panels like the thesaurus panel and others match the "new" contents of the thesaurus. During this process the keywords of the current file are loaded and set.

The Thesaurus Manager can be opened from other sections in IMatch, e.g. the Command Palette.
The Thesaurus can be changed by other means, e.g. by apps or scripts.

In all cases, the Keyword Panel receives a "thesaurus has been modified" event and needs to act. It has no idea about how much has changed or which part of IMatch changed the thesaurus.

There are two ways to handle the scenario:
a) Forcefully commit pending changes in the panel before reloading
b) Revert to the original keywords of the selected file after reloading

I opted for b) since this is the cleaner solution. No data is written without the user's direct action.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook