Repository navigation
修复终端模式下发不出空格和退格 - #233
Merged
Merged
修复终端模式下发不出空格和退格#233
Conversation
- 空格是中文输入法的上屏键、退格不产生 TextComposition,两者都不会触发 PreviewTextInput,之前完全发不出去;改在 PreviewKeyDown 里显式发送 0x20/0x08 - 终端输入原先写死 Encoding.ASCII,全角空格和中文都会被替换成 '?', 改为使用设置里的串口编码 Fixes chenxuuu#176 Fixes chenxuuu#217
Owner
|
LGTM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #176
Fixes #217
终端模式的按键只有一个来源,挂在 Frame 上的
PreviewTextInput,但有两类键根本走不到这里:Key.Back本身就不产生 TextComposition所以在
PreviewKeyDown里补上这两个键,直接发 0x20 / 0x08,并把e.Handled置 true,避免输入法模式下重复发送。另外把
Encoding.ASCII换成设置里的串口编码(Tools.Global.GetEncoding()):原先全角空格、中文都会被 ASCII 编码替换成?,看起来也像「空格没了」。说明:我这台机器是 Linux,仓库是 WPF +
TargetFrameworkVersion=v4.6.2的老式 csproj,本地编不了,改动是读代码 + 对照 WPF 的输入事件链改的,麻烦你在 Windows 上跑一下确认手感(尤其输入法开着时连续敲空格/退格)。