mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
* Set character mode for input stream * Move watchers in receiver + sync when p pressed * Integration tests manual sync * Add a console to DevSession * Vendor * Skip pressKey tests on Windows * Add interactive test for p press * Add info about pressing p key * Doc * Review * Rephrase Manul sync * Fix HotReloadCapable * Document timers * Document enableCharInput * Document geyKey and getKeyWatcher functions * Avoid to Kill in AfterEach after running Kill before
21 lines
626 B
Go
21 lines
626 B
Go
package watch
|
|
|
|
import (
|
|
"golang.org/x/sys/windows"
|
|
)
|
|
|
|
// enableCharInput is inspired from Windows implementation of MakeRaw in golang.org/x/term
|
|
// It enables the treatment of input stream char by char instead of line by line
|
|
// See https://docs.microsoft.com/en-us/windows/console/setconsolemode for reference
|
|
func enableCharInput(fd int) error {
|
|
var st uint32
|
|
if err := windows.GetConsoleMode(windows.Handle(fd), &st); err != nil {
|
|
return err
|
|
}
|
|
raw := st &^ (windows.ENABLE_ECHO_INPUT | windows.ENABLE_LINE_INPUT)
|
|
if err := windows.SetConsoleMode(windows.Handle(fd), raw); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|