terrychou / iVim

A vim port to iOS.
601 stars 34 forks source link

writing a file removes file tags from it #184

Open HeladoDeBrownie opened 3 years ago

HeladoDeBrownie commented 3 years ago

to reproduce:

  1. write a new file
  2. from :idocuments or the files app, long press the file, press tags, and add a tag to it
  3. return to ivim and write to it again
  4. return to :idocuments or the files app and observe that it no longer has a tag
terrychou commented 3 years ago

I have confirmed this issue. However, this also happens to internal documents: 1) in Files app, add tags to one of iVim's document; 2) edit the file in iVim and save it; 3) the tags disappear.

It turns out, Files app's tags support seems limited on iOS or iPadOS. Apps cannot manipulate its tags since the related APIs are not available on these platforms.

HeladoDeBrownie commented 3 years ago

sorry, i don't understand what's different between what i said and what you added.

is there something inherent about the way ivim/vim writes files that makes this harder to deal with than usual? most apps do not erase tags when they edit files.

terrychou commented 3 years ago

I thought we were talking about external files.

Anyway, I think this happens because vim does file IOs through low-level standard C library but the tags are maintained via the API level specifically by Apple (e.g. NSFileManager or NSURL). Which means vim does not respect the tags mechanism.

I tried to obtain the tags beforehand and restore them afterward. Unfortunately, the way I know (via NSURL resources) is not available on iOS.

HeladoDeBrownie commented 3 years ago

ah, well thanks for taking a look at it!