Skip to content
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

don't modify file when I don't modify it #2148

Closed
sgon00 opened this issue May 25, 2020 · 9 comments
Closed

don't modify file when I don't modify it #2148

sgon00 opened this issue May 25, 2020 · 9 comments

Comments

@sgon00
Copy link

sgon00 commented May 25, 2020

OS: 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.

@sgon00 sgon00 changed the title honor file edited state when I don't modify anything in purpose don't modify file when I don't modify it May 25, 2020
@aisbergde
Copy link

for me it's also very strange and very unwanted that files are changed when I don't explicitly change them. I want to act an editor as a "normal" editor does (notepad++, VS Code).

On the other hand external changes should be detected, what not happened. I will create a separate issue for this.

@FilipVerhaeghe
Copy link

External change detection is working well for me on macOS, and very useful to edit Git-based documents.

@aisbergde
Copy link

External change detection is working well for me on macOS, and very useful to edit Git-based documents.

That's fine and that should be the case.
But this issue here is also about marktext sometimes generating "changes" when nothing was changed, not in marktext and not outside.

When I used marktext yesterday the first time I was shocked that nearly all files I only opened to read them have been marked as changed.

But I am really impressed about marktext, so clear. Make links work #2165, and I could use is as my default markdown tool!

@sgon00
Copy link
Author

sgon00 commented Jun 4, 2020

@aisbergde Sorry to say the following words here. I have given up marktext after trying it three days. I am not sure how powerful your PC is. I am kinda unable to edit a file which only has 1229 lines. It caused 100% usage of a CPU core. I stated the fact in this issue. I never thought that file was a big file though. I got many files which is much bigger than that one. To avoid you wasting time on trying marktext like me, you'd better try to open and edit your file with thousand lines to see if your PC can handle it or not.

Marktext is great. The UI, features and so on. But the two main problems to stop me using it are (1) the performance. (2) modify file unexpectedly (this bug).
You can see that the performance improvenment issue is opened at 2018. I don't think these two issues will be addressed anytime soon.
I may try marktext again after 2 years if both performance and this issue are fixed at that time.

Currently, I am using vscode as markdown editor (live preview with Ctrl+K, V) and happy with that. I can create own extension (plugin) to satisfy my requirements. It's fast and works like a normal editor. (but note that it's a full featured programming IDE instead of a simple markdown editor. It's NOT a WYSIWYG markdown editor. It has built-in markdown live preview feature with two panes)

Btw, I tried typora too. typora is OK and NOT slow. Sometimes, it marks the document edited too by moving the mouse through code fence. The main problem stopping me use it is because it's not open sourced and no plugin system. I need shell-session syntax highlighting in code fence. None of the markdown editors support it out-of-box. So I have to hack it to support it. With typora, it's closed source, so I am unable to hack it supporting shell-session syntax.
Just share some of my experience.

@aisbergde
Copy link

@sgon00 Thanks for sharing experience. I also want to share my experience:

My default markdown editor for a long time is VSC (I use it not only for markdown, markdown is only a side effect). There are good markdown plugins (markdown all in one, markdownlint, Markdown PDF, ...) sometimes I go crazy when a file I want to open opens in the preview windows group and I get a new group with a new preview is opened. That's why I am not full happy with the preview.

A few days ago I found marktext and I was impressed about the easy and clean interface and the easy way to see what I write not needing a preview window. Also the idea to copy and paste images (maybe there is a plugin in VSC, I need to search). Search and TOC navigation are great and easy, I miss this TOC navigation (maybe I should search a plugin?)

But the build in auto correction #2171 is a no go. Any change of my source text without my permission in any program is a no go. So currently I will not change the default editor from VSC to marktext until this uncontrolled changes happen.

typora also looks great. No open source as you wrote, maybe there will be a payment in the future. But if it also modifies my source text not asking me then maybe I even should not start to evaluate?

I also found https://github.com/notable/notable
My idea is to build a markdown plain text based notes system where I could easy tag and find required information. Notable has a tagging system, writes tags in YAML metadata, there is also a fulltext search and is has many basic features, but currently it would not replace VSC as default markdown editor because I still miss many features I have in VSC.

Yesterday I had a first look on https://github.com/dvorka/mindforger
The idea behind is great, to build a markdown plain text based knowledge system, to easy restructure markdown files by moving "sections", but it has some issues an a 4K Monitor and I think it could not so easy be used as default markdown editor.

It seems that all roads lead back to VSC. :-)

But I still will investigate marktext, it is open source and I think it is a great product. I will have a look on the performance as you suggested.

@sgon00
Copy link
Author

sgon00 commented Jun 4, 2020

@aisbergde Thanks for sharing your story.

If you haven't tried typora, you may try it. It's very similar to marktext. As what I said before, the only problem which stops me using it is I can not make it work with shell-session syntanx highlight. something like user@host$ command -arg # comment. I used this kinda code fence a lot. If you don't have this requirement, you can use typora.

Typora doesn't really modify the file without asking. The title bar just reports a wrong edited status when you move your cursor through code fence. Since I am a linux user, I rarely use my mouse. When I navigate the document with UP/DOWN buttons and make the cursor cross the code fence. The file titlebar will mark the document as EDITED status. But I did a test and the file is actually not modified at all. If you can suffer this wrong status (typora github has already had this issue open), typora is good to you. The main advantage is the performance. When I open large files, the speed is good and my CPU feels happy. But in marktext, even a few lines of small files will make me feel bad in performance. Moving cursors up and down in marktext is a nightmare.

The only important feature that typora does not handle well compared to marktext is window tabs. It doesn't support tab in Linux. Since all MacOS apps support tabs natively, it does support tab in MacOS. So if you like tabs instead of new window, this might be the downside.

Both typora and marktext support a good TOC sidebar. This is the only problem I had with vscode. I googled vscode TOC extensions, but so far, no good one can compare with typora and marktext.

That's all. Good Luck.

@aisbergde
Copy link

@sgon00

Both typora and marktext support a good TOC sidebar. This is the only problem I had with vscode. I googled vscode TOC extensions, but so far, no good one can compare with typora and marktext.

After writing my comment, I found, this is available by default in VSC:

  • Exolorer View in the sidebar
  • "Outline"
    image

it looks like there are so many useful extensions vor VSC that it should do a good job for markdown. And also as a markdown based note system. I found this excellent article:
https://kortina.nyc/essays/suping-up-vs-code-as-a-markdown-notebook/

I will continue testing marktext, typora and Notable in parallel.

@sgon00
Copy link
Author

sgon00 commented Jun 4, 2020

@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. ^_^

@fxha
Copy link
Contributor

fxha commented Jun 6, 2020

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!

@fxha fxha closed this as completed Jun 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants