lxqt / pcmanfm-qt

File manager and desktop icon manager (Qt port of PCManFM and libfm)
https://lxqt-project.org
GNU General Public License v2.0
425 stars 112 forks source link

Files may be deselected when edited by some apps #1935

Closed ralf3u closed 3 months ago

ralf3u commented 3 months ago

Steps to reproduce open PCManFM-Qt in Compact View navigate to a file where there are a lot of documents mark an odt-document press enter type a word save the odt-document close libreOffice Writer

Result an other document is in focus in PCManFM-Qt

Expectation the odt-document should still be marked in PCManFM-Qt

Remark the same issue appears also with txt-documents with the editor Geany

System Lubuntu 24.04 PCManFM-Qt 1.4.1

if this issue does not exist in PCManFM-Qt 2.0.0, then I'm sorry for this report

isf63 commented 3 months ago

Doesn't affect 2.0.0 for me. Libreoffice and Geany create temporary files when editing, which could interfere somehow.

tsujan commented 3 months ago

Uncheck PreferencesBehaviorSelect newly created files if you don't want that, but by doing so, you'll lose the features of that option.

The root of the problem is in those apps: they instantly create a visible temporary file, then put its contents into the original file, and finally delete the temporary file. The correct way is to make that temporary file hidden.

ralf3u commented 3 months ago

[...] they instantly create a visible temporary file, [...]

I can't confirm this behavior. After editing a TXT-document in Geany, in pcmanfm-qt I can't see a visible temporary file at all. A folder is in focus that has nothing to do with the edited document.

tsujan commented 3 months ago

I can't see a visible temporary file

Because it's created and deleted instantly. If you do as I said, you'll see that the selection will persist.

tsujan commented 3 months ago

For future reference:

No acceptable workaround is possible when Select newly created files is checked, because the time interval between creation and deletion of a temporary file is unknown. It depends on the size of the original file, the amount of changes made to it, the speed of the hard drive (HDD vs SSD), etc.

The most logical approach is that apps should use hidden files for their temporary activities. Sadly, some well-known apps don't.

Most file managers select new files — if they do it at all — only when they create those files. That's suboptimal because new files can be created by other apps (text editors, archive managers,…) — unless those apps are integrated with the file manager, which contradicts modularity.

ralf3u commented 3 months ago

The most logical approach is that apps should use hidden files for their temporary activities.

I don't know if this would really solve the problem. Let's imagine someone uses pcmanfm-qt and wants to see always the hidden files by pressing Ctrl+H. Then I think that the issue will still be there. Is that correct?

tsujan commented 3 months ago

Let's imagine someone uses pcmanfm-qt and wants to see always the hidden files

Then they get what they choose.

Then I think that the issue will still be there.

As I explained in details, there's no issue to fix.

ralf3u commented 3 months ago

If in the applications (like Geany or LibreOffice Writer), in the preferences, there would be a possibility to define a special file where the temporary files are stored, so not in the same file where the documents are stored, then the problem would not appear any more in pcmanfm-qt. Is that correct?