mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 03:23:49 +08:00
27 lines
577 B
Go
27 lines
577 B
Go
package terminal
|
|
|
|
import (
|
|
"os"
|
|
|
|
"golang.org/x/sys/windows"
|
|
)
|
|
|
|
// DisableQuickEdit 禁用快速编辑
|
|
func DisableQuickEdit() error {
|
|
stdin := windows.Handle(os.Stdin.Fd())
|
|
|
|
var mode uint32
|
|
err := windows.GetConsoleMode(stdin, &mode)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
mode &^= windows.ENABLE_QUICK_EDIT_MODE // 禁用快速编辑模式
|
|
mode |= windows.ENABLE_EXTENDED_FLAGS // 启用扩展标志
|
|
|
|
mode &^= windows.ENABLE_MOUSE_INPUT // 禁用鼠标输入
|
|
mode |= windows.ENABLE_PROCESSED_INPUT // 启用控制输入
|
|
|
|
return windows.SetConsoleMode(stdin, mode)
|
|
}
|