-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
运行程序后方向键不可用 #29
Comments
这个切换的key是 |
ok, 更新了 |
这个切换key是 |
cmd是吧,我试试 |
ok,我也出现了,我看看 |
@shiluanzzz 我好像找到原因了,跟这个方法有关https://github.com/muesli/cancelreader/blob/main/cancelreader_windows.go#L189 现在有一个简单的修复办法,你可以运行完demo之后在运行: func main() {
var originalMode uint32
windows.SetConsoleMode(windows.Handle(os.Stdin.Fd()), originalMode)
} 我晚上想想怎么写。 |
问题很诡异。 跟 demo code: package main
import (
"fmt"
"golang.org/x/sys/windows"
"unicode/utf16"
)
var fileShareValidFlags uint32 = 0x00000007
func main() {
var originalMode uint32
handle, _ := windows.CreateFile(
&(utf16.Encode([]rune("CONIN$\x00"))[0]), windows.GENERIC_READ|windows.GENERIC_WRITE,
fileShareValidFlags, nil, windows.OPEN_EXISTING, windows.FILE_FLAG_OVERLAPPED, 0)
_ = windows.GetConsoleMode(handle, &originalMode)
// 503
fmt.Println(originalMode)
// problematic mode
//windows.SetConsoleMode(handle, 992)
} link: |
@shiluanzzz 你拉下最新的代码,在试试 |
good job |
在使用仓库提供的demo,执行前方向键可以正常使用,执行后方向键不可用,会被识别成[[A字符
windows终端,winterm, cmd下都出现了这个问题。
编译成可执行文件后在执行同样出现。
go version go1.18.1 windows/amd64
The text was updated successfully, but these errors were encountered: