Example #1
0
// DisableFlags disables the terminal flags specified in the function
// argument 'flags', and returns the previous state of the terminal
// so that it can be restored.
func DisableFlags(fd FileDescriptor, flags Flag) (*State, error) {
	var st uint32
	err := syscall.GetConsoleMode(handle(fd), &st)
	if err != nil {
		return nil, err
	}
	st &^= uint32(flags)
	err = win.SetConsoleMode(handle(fd), st)
	return &State{st}, err
}
Example #2
0
// Restore restores the terminal connected to the given file descriptor to a
// previous state.
func Restore(fd FileDescriptor, state *State) error {
	return win.SetConsoleMode(handle(fd), state.mode)
}