don't modify file when I don't modify it
See original GitHub issueOS: debian 10.
I found my file changed to edited mode all the time when I don’t actually modify anything. I have disabled auto trim empty lines. Auto-save is not enabled by default, so I don’t have it enabled. The tested file contains only the following content:
``` ```
So far, I can reproduce three cases:
Case 1: Switch to source code mode. And then disable source code mode (Switch to normal mode). The file will become modified (edited mode). This really doesn’t make sense to me.
Case 2:
Use DOWN
key button, I can see the cursor can move to new lines even if I don’t create them by ENTER
key. Now, the magic part: clicking anywhere (empty lines) above your current cusor position. marktext will create all empty lines for you. This is really unexpected. I am not pressing ENTER button. Only DOWN
button and LEFT mouse button. That’s all.
Case 3: Close the file in marktext. Use some other editor to add TAB inside the document. Reopen it with marktext. All tabs becomes spaces and file become edited.
I really care about my file state and its file conent. When I don’t manually modify it, I want it to remain untouched state. The magic edited mode, adding empty lines and changing TAB to spaces without my permssion are really unexpected. I want to take control of the file content. I don’t want the file to be modified magically without knowing what’s going on.
I have opened quite some issues since I used marktext from yesterday. Very excellent tool. Thank you very much for your time.
Edited:
I just found some other cases.
Case 4:
There are two tabs opened. Tab1 and Tab2. In Tab2, I have the following:
``` ```
The mouse cursor is outside the code fence. I created the file content in source code mode and then switch to non source code mode. Click Tab1. And then click Tab2 again. The tab2 file will become edited mode and the mouse cusor will jump to code fence inside.
Case 5:
Based on Case 4, in tab2, I remove everything and make it empty first. And then in normal mode (non-source code mode), I input ```, then Enter, It will create the code fence for me. I use Ctrl+S to save the file. Click Tab1 and then click Tab2 again. The weird thing happened. The file inserts another ``` for me. So in the end, I will have the following content:
``` ``` ```
Case 6:
I have disabled trim empty lines in preference.
There are two tabs open, tab1 and tab2.
In tab1, at the end of the body, press ENTER
button to create a new empty line.
Switch to tab2.
Switch back to tab1.
The file becomes edited and the new line I created is gone.
Case 7:
I just figured out table has the same problem as code fence. If I have mutliple tabs open, the current tab has a table and my cursor is one line after the table, the file will become modified when I navigate to another tab and then navigate back. I can see the cursor jumps from the line under the table into the table’s column.
Case 8:
This is a weird case. I don’t know what happened and not sure how to reproduce it.
I have a file which only has 6 lines.
Since it’s a small file (6 lines), I like to put my cusor at the end.
But the magic thing happened. It keeps becoming modified. I have to keep pressing Ctrl+S
.
There is even a snackbar notification to inform me the file is modified at disk if I want to reload the file. I am 100% sure no process is accessing this file except marktext.
marktext just keep making the file modified kinda forever.
I did some modification to the file in source code mode and switch back and so on. Many actions. add newlines, remove newlines etc… I can’t remember every steps.
Finally, the file is in peace for a while. But later, when I navigate to another tab and back, the file becomes modified again. It’s only 6 lines. One head1, One empty line, 4 lines of URLs.
(PS: I met the same problem again in another file. The snackbar keeps telling me the file is modified at disk and ask me to reload. I have no ideas what’s going on. The only way to stop it this time is to quit and restart marktext. I haven’t figured out how to reproduce this weird bug)
Anyway, just the following sentence that I emphasized. I don’t know why marktext keeps modifying my file. As a coder/programmer, I don’t feel well that my file gets modified without my permission.
I want to emphasize that the file should not be modified if I don’t modify it manually. Thanks a lot.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:9 (1 by maintainers)
@aisbergde Thank you VERY MUCH for letting me know the outline is actually the TOC in VSC by default. I never realized it in the two days of use. I spent most of the time to hack an extension to support shell-session syntax highlight in code fence and finanly did it. Thanks a lot for that URL too. You save my markdown life. ^_^
I’m closing this issue in favour of #2189. You may want to subscribe there for further updates.
@aisbergde @sgon00 Please stick to the topic, thanks!