As default editor for other programs: how to load a file in sync?

hexaae
Posts: 69
Joined: 25.02.2019 20:47

As default editor for other programs: how to load a file in sync?

Post by hexaae »

Example:
I have a ZIP unarchiver/browser tool, which allows me to edit text file directly from an external editor, and save it back to the ZIP archive (on file close, after editing, the ZIP tool will ask me: "The file has been changed. Do you want to update the archive contents?"). This works fine with Notepad.exe.
But what if I want to use CudaText? As far as I can see it loads the file "in async mode" loosing file lock... so the above ZIP tool won't notice the changes in the temp file...
Is there a quick solution?
main Alexey
Posts: 2245
Joined: 25.08.2021 18:15

Re: As default editor for other programs: how to load a file in sync?

Post by main Alexey »

What is 'in async mode'?
no, Cud loads file normally, as I know.
The DoubleCommander can call external editor from Zip. and then it detects that file's date/time is changed.
works OK with Cud.
hexaae
Posts: 69
Joined: 25.02.2019 20:47

Re: As default editor for other programs: how to load a file in sync?

Post by hexaae »

I have some problems with Cudatext and BandZip...

Oh, I've just found it works as expected if it's the only tab open in Cudatext... but if you have already open multiple tabs BandiZip fails to detect changes:
1. CudaText is already open with multiple tabs...
2. BandiZip runs as external editor cudatext.exe
3. so BandiZip opens another tab in Cudatext to edit selected file from the zip file...
4. after editing and closing the tab or the whole CudaText task (with the other tabs still open), BandiZip won't detect the changed file (??)

It seems I have to close ALL Cudatext tabs and then quit the main window to make BandiZip detect changes...
With new notepad in Win11 even on closing the single tab used for editing works fine and BandiZip is able to detect changes.
main Alexey
Posts: 2245
Joined: 25.08.2021 18:15

Re: As default editor for other programs: how to load a file in sync?

Post by main Alexey »

Option must help here:
"ui_one_instance": false,
(in user.json)

Because with _single_ instance, BandiZip sees that 2nd Cud instance closes fast, and it thinks that editor (2nd instance) did not change anything.

maybe you can ask BandiZip author to detect file change _by timestamp_ instead of 'process ended'.
hexaae
Posts: 69
Joined: 25.02.2019 20:47

Re: As default editor for other programs: how to load a file in sync?

Post by hexaae »

"ui_one_instance": false,
didn't help unfortunately (still have to close all other tabs or BandiZip will ignore text changes on closing CudaText).

Asked in the official forum in the meanwhile: https://groups.google.com/g/bandizip-win/c/PkXc0usAyL4
main Alexey
Posts: 2245
Joined: 25.08.2021 18:15

Re: As default editor for other programs: how to load a file in sync?

Post by main Alexey »

i hope you restarted all Cud instances after setting option to False.
hexaae
Posts: 69
Joined: 25.02.2019 20:47

Re: As default editor for other programs: how to load a file in sync?

Post by hexaae »

It works with False (will open a second instance of CudaText with the file from ZIP), but I have to close the whole task (closing the single tab for this new instance is not enough) to make BZ detect changes... Mmmh, it seems there is no optimal solution. BZ author also explains BZ gets fooled by the fact the new instance of CudaText will actually redirect the file to the other CudaText open task, and then closes itself ("ui_one_instance": true, as default). He also adds that timestamp change isn't reliable as well so won't change it...

BTW, why notepad.exe works as expected instead? Closing the new tab will immediately notify BandiZip. Does it run in a separate task each tab with new notepad.exe? Maybe this could be a feature request for future CudaText...
main Alexey
Posts: 2245
Joined: 25.08.2021 18:15

Re: As default editor for other programs: how to load a file in sync?

Post by main Alexey »

I don't know how notepad.exe makes this. So i cannot mimic it. So feature request cannot be made (yet).
Maybe you can see running processes list ("Task Manager" app, AFAIR).
main Alexey
Posts: 2245
Joined: 25.08.2021 18:15

Re: As default editor for other programs: how to load a file in sync?

Post by main Alexey »

BTW, command line option exist to run Cud always as new instance.

Code: Select all

  -n              - Ignore option "ui_one_instance", open new app window
it may be useful in this usecase. If BZ allows to write it to config.
main Alexey
Posts: 2245
Joined: 25.08.2021 18:15

Re: As default editor for other programs: how to load a file in sync?

Post by main Alexey »

These cmd-line options are good too:

Code: Select all

  -nh             - Ignore saved file history
  -nsl            - No session loading on start
  -nss            - No session saving on exit
Post Reply