Repository: vscode
Issue: Substitution performed when accepting a Kanji conversion of Japanese input method
Labels: bug,editor-input-IME,confirmed

<!-- ⚠️⚠️ Do Not Delete This! bug_report_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- 🕮 Read our guide about submitting issues: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions -->
<!-- 🔎 Search existing issues to avoid creating duplicates. -->
<!-- 🧪 Test using the latest Insiders build to see if your issue has already been fixed: https://code.visualstudio.com/insiders/ -->
<!-- 💡 Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. -->
<!-- 🔧 Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: Yes

<!-- 🪓 If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. -->
<!-- 📣 Issues caused by an extension need to be reported directly to the extension publisher. The 'Help > Report Issue' dialog can assist with this. -->
- VS Code Version: Version: 1.83.0 (Universal) Commit: e7e037083ff4455cf320e344325dacb480062c3c
- OS Version: macOS 13.5.2（22G91）

Steps to Reproduce:

1. Setup Japanese keyboard. Add 日本語 - ローマ字 (Japanese - Romaji) keyboard to your environment. For details, see [Set up a Japanese input source on Mac](https://support.apple.com/en-ca/guide/japanese-input-method/jpim10267/6.3/mac/14.0).
2. Disable live conversion. For details, see the section _Use traditional conversion_ in [Enter Japanese text using a Japanese input source on Mac](https://support.apple.com/en-ca/guide/japanese-input-method/jpim10265/mac).
3. Create new text file and paste the following text to multiple lines:
   ```
   これを置換したい。
   ```
4. Open the Find & Replace box. (Select "Edit > Replace" in menu.)
5. Click the Find field.
6. Switch to Japanese keyboard. (`⌃⇧J`)
7. Type `korewo`. The input text would be `これを` with underline, which shows the text has not been accepted yet.
8. Type `↵` (return key). The input text is accepted without conversion.
9. Type `chikanshi`. The input text would be `ちかんし` with underline.
10. Type `␣` (space bar). The input text would be converted to `置換し`.
11. Type `↵`. The input text is now accepted.
12. Type `⇥` (tab key). The focus is now on the Replace field.
13. Type `korewo`. The input text would be `これを` with underline.
14. Type `↵` to accept.
15. Type `okikae`. The input text would be `おきかえ` with underline.
16. Type `␣` to convert. The input text would be converted to `置き換え`.
17. Type `↵` to accept.
18.  Type `↵` to execute the replacement.

The above steps show a typical example of Japanese input; note that the return key is used both to accept the conversion and to execute the process (in this case, replacement).

Expected result:

Replacements are performed only if there is no unaccepted text.

Actual result:

When a conversion is accepted, replacement is performed at the same time.

https://github.com/microsoft/vscode/assets/1079715/729b6538-5cf1-4946-9a77-89072d31e5a9