marktext / marktext/marktext

[Bug] Japanese IME input breaks when typing immediately after a code fence

Open
#4,851 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
61.6k
Forks
4.6k
Avg merge
23h 49m
Merged PRs (30d)
89

Description

Description

When typing Japanese text with an IME immediately after a code fence, the input becomes broken after the first character.

This seems to happen when I start typing Japanese text right after creating a code fence with three backticks and moving to the next input position.

Steps to Reproduce
  1. Make sure Source Code Mode is disabled.
  2. Open MarkText 0.20.0-beta.5.
  3. Create a new document.
  4. Type three backticks to create a code fence.
  5. Press Enter or move the cursor immediately after the code fence.
  6. Try typing Japanese text using a Japanese IME.
    For example, try typing "てすと".
Expected Behavior

Japanese text should be entered normally.

For example, when typing "てすと", it should appear as "てすと" without any broken or unexpected characters.

Actual Behavior

The first character is entered correctly, but the second character becomes broken or unexpected.

For example, when I try to type Japanese text, the result may become "nあ" or "kあ" instead of the expected input.

After that, the third and later characters can usually be typed normally.

In another test with repeated input, the result became something like "かkあかかかかかかかかか".

This issue reliably happens when Source Code Mode is disabled.

I could not reproduce it when Source Code Mode was enabled.

When Typewriter Mode is enabled, the behavior becomes less consistent: sometimes the issue happens on the first character, and sometimes it does not happen.

Screenshots / Logs

Screen recording/GIF:

Screen recording showing the Japanese IME input issue
Operating System

Windows

MarkText Version

v0.19.1

OS Version

Windows 11 25H2, Microsoft Japanese IME

Reproducibility
  • I can reliably reproduce this issue

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file, test, or entry point is named. Start by reproducing the issue on Windows 11 with Microsoft Japanese IME in MarkText with Source Code Mode disabled, then compare behavior around a newly created code fence. Done means Japanese input remains correct immediately after the fence, including the reported "てすと" example.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, markdown, typescript
Domain
desktop, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.