1. Environmental
- MacOS Sierra 10.12.5
- Vscode 1.20.0 latest release
2. How to reproduce the problem
When using Chinese input method to input Chinese, press the back button all the time, for example, enter SFSF. When you press the back button 4 times, you will find that although the sogou input method popup box disappears, there will still be an S on the page. This is how if you press the back button again, S will turn into BS and become a hidden character. This is usually the case with the MarkDown rendering plugin on the right.
To be more specific, this problem will occur as soon as your editor opens webview, even vscode’s welcome page, which is also a webview, will cause this problem. So it’s best to turn webView off when writing code.
3. How to make hidden characters appear
The Mac version of vscode control characters are generally not displayed, you can use the following method to make it displayed
"editor.renderControlCharacters": true
Copy the code
The tiny BS that appears in the editor stands for backspace. This character occasionally appears when you type back or delete.
4. What happens to hidden control characters?
4.1. Question marks appear on Github for control characters
For example, a hidden character appears between the same word and the same character, and a question mark with a background appears on Github.
4.2. The control character in Hexo NexT Local Search will cause the Search. XML rendering to fail and the Search box keeps going in circles
If you open search.xml in a browser, you will find parsing errors
5. How to solve it
5.1. Manually delete hidden characters
You can use substitution, which copies a hidden character and then replaces the hidden character with null
5.2. Use the plugin Remove Backspace Control character
Remove backspace control character
Chromium has been merged in this home, so vscode 1.15 will be reconfirmed in early August (vscode 1.15, electron 1.7.4). As a matter of fact, the problem is still unresolved
The characteristics of
Formatter used to remove control characters contained in open documents. The control character to be deleted defaults to the following.
/[\u0000]|[\u0001]|[\u0002]|[\u0003]|[\u0004]|[\u0005]|[\u0006]|[\u0007]|[\u0008]|[\u000b]|[\u000c]|[\u000d]|[\u000e]|[\ u000f]|[\u0010]|[\u0011]|[\u0012]|[\u0013]|[\u0014]|[\u0015]|[\u0016]|[\u0017]|[\u0018]|[\u0019]|[\u001a]|[\u001b]|[\u00 1c]|[\u001d]|[\u001e]|[\u001f]|[\u001c]|[\u007f]/gmCopy the code
usage
- Editor. formatOnSave: true If set, starts when saving
- “Editor. formatOnType” : true when converting, if set; Start on input
5.3. Wait for a better solution from the authorities
The official bug is still open. Using IME with markdown preview enabled, press ESC/BACKSPACE leads in control characters #37114
5.4. Close all WebViews
This problem usually occurs when a TAB contains a webview, so after upgrading to the latest version of vscode, when writing code, be careful not to open any TAB with a webview, including
- Turn off the markdown rendering plugin for real-time rendering
- Close the vscode welcome TAB
6. Why don’t the authorities address the problem directly?
-
Vscode uses electron underneath, The electron Backspace can not erase the last one character during Japanese IME conversion (macOS) # 9173Bug If electron doesn’t solve this problem, vscode won’t.
-
Electron uses Chromium in the bottom layer, which is chromium’s Two backspaces required to delete last character in webview inputbug, which Chromium does not solve. Elctron can’t solve it.
-
To sum up, at the time of writing, the problem remains unresolved.
Reference 7.
- Does VSCode on Mac always show hidden characters when writing Markdown?
- The Local Search feature of the Hexo Next theme is disabled, and clicking the search link does not pop up the overlay layer
- Backspace can not erase the last one character during Chinese/Japanese IME conversion (macOS) #24981
- Backspace can not erase the last one character during Japanese IME conversion (macOS) #9173
- Two backspaces required to delete last character in webview input
- Control characters
- Using IME with markdown preview enabled, press ESC/BACKSPACE leads in control characters #37114