jacobwhall / marktext

fork of marktext, seeking to modernize our favorite markdown editor
MIT License
124 stars 3 forks source link

IME mode isn't automatically escaped when pressing Ctrl + S in Source Code Mode, causing user to save twice. #19

Open TetraTheta opened 1 year ago

TetraTheta commented 1 year ago

Description

If user tries to save file with Ctrl + S in Source Code Mode, IME mode isn't automatically escaped.

Pressing Ctrl + S first time escapes IME mode, but don't save the file. So user must press Ctrl + S again to save file.

Steps to reproduce

  1. Make sure that you're using language with IME mode, such as Chinese, Japanese, Korean etc.
  2. Write some texts on Editor Mode
  3. Save document with Ctrl + S on Editor Mode
    It will be saved with automatic IME mode escape
  4. Toggle to Source Code Mode by pressing Ctrl + E
  5. Write some texts on Source Code Mode
    Make sure you don't escape IME mode with Space or Enter or arrow key etc.
  6. Save document with Ctrl + S on Source Code Mode First attempt will fail while escaping IME mode
    Second attempt will save file correctly

Expected behavior

When pressing Ctrl + S, IME mode should be escaped and file should be saved too, just like in Editor Mode.

Actual behavior

Only IME mode is escaped when pressing Ctrl + S while at IME mode.

Versions

Additional Note

I'm not sure if this is related to https://github.com/marktext/marktext/pull/3419 but I really don't know why this problem happens.

This problem won't be easy to reproduce for people not in East Asia because they don't have IME mode in their keyboard/language. You might need to install CJK language pack and switch to corresponding keyboard layout to reproduce.

Instead of posting issue in marktext/marktext, I choose to post it here because this repository is much more active than the origianl.

jacobwhall commented 1 year ago

Thank for for the detailed bug report.

This problem won't be easy to reproduce for people not in East Asia because they don't have IME mode in their keyboard/language. You might need to install CJK language pack and switch to corresponding keyboard layout to reproduce.

Yes, unfortunately this will take some time and research on my part. I can't commit to doing so in the near-term. I added the "help wanted" label to this issue, in case someone is able to help fix it.