marktext / marktext

📝A simple and elegant markdown editor, available for Linux, macOS and Windows.
https://www.marktext.cc/
MIT License
47.23k stars 3.51k forks source link

Issue to erase text in preview mode #389

Closed haroal closed 5 years ago

haroal commented 6 years ago

Description

In preview mode, I can't erase text by selecting it using Cmd+A, and then taping backspace. It seems to be removed, but if I go to Source code mode I still can see what I wrote, and when I go back to the Preview mode the text has reappeared. I can also see that my text has not been removed by using the down arrow key: my cursor moves and reveals the "erased" text.

Steps to reproduce

  1. Type some text
  2. Select all using Cmd+A
  3. Press backspace key to erase
  4. Use arrow keys to move in the file and make the erased text to reappear

or

  1. Type some text
  2. Select all using Cmd+A
  3. Press backspace key to erase
  4. Go to Source code mode and see the erased text still present
  5. Go back to Preview mode and see the erased text reappeared

Expected behavior: The text is really erased.

Actual behavior: The text is not erased : it is simply removed from the preview.

Example:

mark_text_issue

Versions

Jocs commented 6 years ago

I can not reproduce it on my macOS, could you please download latest version 0.12.25, and try again?

haroal commented 6 years ago

I already tried with the v0.12.25 and update the issue : it is happening exactly the same thing. Could it be due to my nodejs/electron versions? Is it a debug mode or something to see logs to understand where the issue comes from?

Jocs commented 6 years ago

@haroal Can you alway reproduce this bug?

haroal commented 6 years ago

Yes. With the new version, even after restarting Mark Text, even after restarting my computer. It always happens. I even tried to uninstall and reinstall it and it still happens.

minosss commented 6 years ago

I reproduce this bug using cmd+backspace.

and some time switch mode, the content will recover, because of cmd+backspace.

marktext 0.12.25 macOS 10.13.5

Jocs commented 6 years ago

@minosss What keyboard do you use, Mac pro keyboard or an external keyboard?

haroal commented 6 years ago

Personally, I use the built-in keyboard of my MacBook Air 2015 and Cmd+backspace does the same thing as backspace only

minosss commented 6 years ago

@Jocs MBP Mid 2014, both built-in keyboard and HHKB will reproduce the bug

fxha commented 6 years ago
  1. Type some text
  2. Select all using Cmd+A
    1. Press backspace key to erase
  3. Go to Source code mode and see the erased text still present
  4. Go back to Preview mode and see the erased text reappeared

You have to wait for 200ms (I think, maybe more) before you switch preview-/source-code mode because text events are forwarded all 200ms for performance reasons.

Edit: I can reproduce the first problem on Linux if I press Ctr+A & Backspace & ↓ in under 200ms.

Jocs commented 5 years ago

I think this has been fixed on develop branch, feel free to reopen it.