Script in floating menu item dissappear / filled with null char ^@

If I edit an existing applescript (external file) here:

it seems that the changes are saved, but if I close BTT config window or simply click on another menu item (or anything else which will move away from this configuration) upon returning the file path is still visible and correct, but text box is empty (which was not the case with previous versions, however I cannot say when this start happening since I haven't edited scripts recently) and the script is not being executed even upon clicking "Run Script" button.
If I choose Inline Text and paste the script everything works as expected.

does the referenced file contain any code?

It seems to work fine here, are these files accessible by BTT? (Maybe I need to implement some code to request permission for certain paths if BTT doesn't have the "Full Disk Access" permission

//edit, ah maybe the auto-save doesn't trigger correctly. Does it work if you press the save button or cmd+s before switching/closing?

The file contains code:

BTT have permissions. Auto-save works, or at least for inline it is being saved.

What I've noticed is that if I edit the file inside BTT, click on Save (or auto-save it) in vim/nvim the file is shown as (this is only part):

if I cat the file or open it using TextEdit it is shown as expected.

^@ is a null character, however I'm not sure how they would end up in there :-/ (they don't here).

I'll try to specify the save encoding manually, maybe it's some system language related thing

The workaround (hope it will be useful to someone if facing the same issue) I found so far is:

  1. Open the file inside vim/nvim
  2. Select the External file, Save/auto-save which will produce the the null char - you should be able to see it changing in real-time in vim/nvim
  3. In vim/nvim just do undo, which basically will revert the file to its original state and it should starts working again.

Hey Andreas, were you able to implement this or maybe another fix?

unfortunately I haven’t been able to reproduce the issue here yet, it is all working still fine

I wonder whether it’s related to done system setting

I'm only asking because with no changes on my end (like when I've reported the issue) - it is working as expected again, meaning I can edit the file directly from BTT.

ah, one thing I did is explicitly set the encoding, if that solved it, it sounds like the standard encoding differs among systems :face_with_spiral_eyes:

Ah yep, my question was related to:

I'll try to specify the save encoding manually

from your reply

So actually this is the solution I guess.