-
-
Notifications
You must be signed in to change notification settings - Fork 604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some files do not show * when edited and do not save or autosave, no warning when renaming that buffer data will be lost #5109
Comments
Thanks so much for opening up your first issue here on the repository! 🎉
EnhancementsAn enhancement takes a feature and improves or alters its behaviour. Please Feature requestsFeature requests introduce whole new features into the app. This requires a You can of course always ask someone to implement this feature, because a PR Bug reportsPlease note that one of the main reasons for why bug reports cannot be The ideal bug report for us has two qualities:
Please note that if you encounter behaviour that does not align with your But now, have a great day and thank you again! |
I am using zettlr 3.0.5 which I installed from .deb yesterday. |
Ctrl-z/Undo does not work to get the modified text back |
Okay it's actually that Ctrl-S/save isn't working. I tried modifying a file, hitting save, closing it and opening it again and the changes are not saved. So my bad for not checking that zettlr actually saved changes but also... What?? |
The freshly renamed .md files also do not save. However, if I close zettlr and restart, they do save and rename preserves the changes. So there is some weird edge case where modified text is in the buffer but is not saved either by autosave or manual save and there is no warning this is happening. In terminal all files show as user rw. |
after restarting, when a file is modified it has an asterisk by its name and if I try to rename it I get a warning: Cannot rename file: Please save your changes first. I do not understand why some files were/are NOT showing the asterisk when I edit them in the buffer and do not save. |
After closing and reopening zettlr a few times, all of my files are now showing the asterisk when edited and save without trouble. I did not rename all of them; some started working in their original txt file name. I couldn't figure out a pattern for why some worked and others didn't. |
I noticed that the * wasn't showing up as I edited the buffer but I thought that was just because of autosave. :( Maybe related to #4232 ? |
I can fully understand this :( In 3.0.5 (or, rather, 3.0.3 which is the last update that got reasonable changes) there were quite a few smaller bugs across the file saving process, but I think I got rid of most of them. However, it'll be a bit until the next version can be released. That being said, should you encounter this issue more often, feel free to try out the current nightlies, they should be likely comparatively stable already. See also related issue: #4628 |
Yes that looks like the same issue. For what it's worth, in my case also these WERE new files to zettlr AND they were created on a non-*nix system (a portable typing device). It's possible they had the other line endings initially and somehow over a few opens zettlr changed them/somehow became able to track changes properly. |
See attached. This file was created on a Pomera DM100 writing device. It has 6 lines, 4 with text, 2 are empty/blank lines. I transferred two copies of it to my computer. For both copies, when opened in Zettlr (Debian linux 3.0.5) -- with autosave off -- Zettlr does not recognize changes to the file when I edit it. No * is displayed. For one file, I try to manually save anyway with Ctrl-S. The timestamp for that file updates (checked from terminal ls -lh) but the visible file contents do not change (checked with cat). HOWEVER. After the forced Ctrl-S, the number of bytes on that copy has reduced from 222 to 220. In vim, the original copy does not display any visible end of line characters. But the new copy shows ^M (carriage return) at the end of the 4 lines with text. The two blank lines do NOT show the ^M. I suspect those two carriage returns were removed somehow. I close Zettlr and open it again. Now the file that was modified DOES display the * when edited and DOES save the change. After saving, when opened in vim, the ^M line endings on the 4 text lines are also gone. The file that was NOT modified or forced a Ctrl-S still DOES NOT display the * when edited. I close Zettlr and open it again. The file that was NOT modified or forced a Ctrl-S still DOES NOT display the * when edited. I force a Ctrl-S and observed in terminal that this file too has reduced by 2 bytes. When Zettlr is closed and reopened, this file now correctly shows the * when edited. Also of note, when I transfer a file from the device that does NOT have ANY EMPTY LINES (i.e. only a single line, or only text lines with no empty lines separating them) it opens and edits in Zettlr normally. |
Confirmed with cat -E:
|
I ran the latest release I found: Now when I try to edit one of these foreign device files, I get the same sync error warning another user reported (see attached). In console the error says: Which is... an improvement... At least you couldn't keep editing and think things were okay. |
Tried with the latest nightly from https://nightly.zettlr.com/ (April 8). |
Heya, sorry that I only respond now. This does give me a hint that maybe we also have to account for the line endings when comparing the actual file contents from disk, so there may be a residual error in the remove change detection code as well. I'll see to when I have the time to go over it once more and dig around. |
I get the same "Document out of sync" error. |
On Windows 11 with Zettlr 3.1.1, the issue also seems to abate if the content of the "Document out of sync" file is copied into a newly created file. That's less ideal as a fix the more files are involved but may also provide a clue. |
Does this refer to the 3.1.1? Because I specifically fixed that particular issue for the newest release. |
@nathanlesage, yes, sorry, that seems to be correct with Zettlr 3.1.1 on both Windows 10 and 11. A screenshot is below. Also, on trying to import a single file, the Import directory dialog box first appears. On pressing Select folder, the Open file dialog box appears, allowing for a specific file to be selected for import. |
I'll have to take another look. For 3.1.1 I fixed an issue from 3.0.5 in that line endings were improperly detected, but for 3.1.1 I've seen the file system watchdog spitting out spurious messages, so I'm currently a bit afraid that chokidar might … choke. But I need to see a bit more info before I can start looking into it. I'm taking any feedback that helps resolve this issue! |
Thanks so much! |
Occasionally, I'm also receiving the same notice with And … I'm not sure if it's at all related, but the "Duplicate file" option in the right-click menu seems not to be doing anything at the moment—whether with one of the files raising this error or with any other. |
@nathanlesage I just opened a conflicted Markdown file from the GitHub desktop application in Zettlr to resolve the conflicts. When the file attempted to auto-save, I got the same error. The log shows the following:
I'm not sure if that's helpful at all but wanted to pass it along just in case. |
@nathanlesage, I just got this same error (minus the initial bit, which I suspect is a window/document identifier (? - After another error like this, the log also includes the following:
Before opening Zettlr on the Windows 10 machine, I had pushed changes to GitHub from the Windows 11 machine and then pulled the changes down on the Windows 10 machine. But on trying to edit another file, the same (visual) error message in Zettlr leaves only the following in the log:
|
Was Zettlr running while you invoked the git commands? There are still some issues when git changed many files at once. |
No. I updated via GitHub only before opening and after closing Zettlr. |
@nathanlesage, when coming across this error, I had the thought to try
The error I get then is identical (besides the main window hash) to this one. I've then tried to
I get the same error and ones like the first two ("Could not apply delta …") quoted here. I've then tried to
Here again, the same kinds of errors occur with both files. And if I try the option to
So, it seems the only way to make Zettlr "happy" with the file again and render it save-able is to create a brand new file and copy contents into it. This seems to work if one creates the file either within Zettlr or within Explorer. I'm not sure if any of this provides useful information or clues, but I thought it might be useful to try making a workspace look to Zettlr as much as possible like something it had never seen before and then seeing what happened. (Interestingly, if I copy a whole directory and thus have both |
@nathanlesage, I'm not sure this is actually true. On further examination, it looks like--when an entry like this appears--another error of the "pushing updates failed" variety follows. But for some reason, in that circumstance, the "pushing updates failed" error is just delayed in getting written to the log. I've also seen a new error type I hadn't noticed before (again with the same GUI message):
In this case, the line number doesn't seem to correspond to any of the edits I try to make (sometimes before and sometimes after the line number shown in the error). Not sure if any of this is useful but wanted to pass it along in case so. Thanks so much for looking into this issue! |
@nathanlesage, I think I may have come across a series of steps to be able to consistently reproduce at least some variety of this error on Windows 10:
Zettlr doesn't have an issue with files that have blank lines if I've created the file with that installation of Zettlr (e.g., on that machine). But if the blank lines have been added (or the file with them has been created) elsewhere (e.g., in another text editor or in another installation of Zettlr on another machine), this seems to reliably reproduce the "Document out of sync" GUI error in Zettlr 3.1.1. |
Yes, that is what I noticed. Files with text and line breaks but NO blank lines between paragraphs open fine in Zettlr even if created on the other device (each line has text with \r\n endings and on save Zettlr converts to \n endings). But if there is a blank line (\r\n only on a line) Zettlr chokes. There must be some special casing for blank lines somewhere, maybe they're hard coded as 1 character but in this case they're 2? |
@rdhutchins and @Ardhanm, thanks so much for your thoughts. Adding these to the pile, the issue---at least in my case---seems to derive from two things:
|
Actually, this isn't quite sufficient. Git's It may not be news to anyone else, but in case it's useful to someone who stumbles upon this thread, you should be able to check each local repository to see if any files have CRLF endings with
And that should show that Git has converted the CRLFs Windows prefers to the LFs Zettlr expects (rather than needing to copy and paste contents into new files and save those back over old files to set things working again). As an interesting (and related?) aside, Zettlr seems to handle just fine other file types (e.g., |
Description
I had a .txt file open and was editing it. Autosave was on. After some time I decided to rename the file to .md using the left side file tree. I only noticed sometime later that I had lost all my edits - the file had reverted to the data it had when I first opened it. I turned off autosave and tested again with another file (I added a single line and saved it with ctrl-s). Upon rename, it happened again!! I don't know where the initially loaded text was even saved?? Somewhere in memory? I couldn't find any autosave or backup files in the directory.
Reproducing
See description
Zettlr Version
Stable (most recent version)
Specify version
No response
Installation Method
From the Website or GitHub
Your Platform
Architecture
Operating System Version
Debian 12
Additional Information
I'm really sad :(
The text was updated successfully, but these errors were encountered: