Skip to content

Commit 27f29d8

Browse files
aymanbagabasprattmic
authored andcommitted
term: remove duplicate flag and add comment on windows
Both windows.ENABLE_PROCESSED_INPUT and windows.ENABLE_PROCESSED_OUTPUT have the same value of 0x1. Using makeRaw on a console output screen buffer handle wouldn't make sense since on Windows the input handle and the output screen buffer handle are two separate things. See https://learn.microsoft.com/en-us/windows/console/setconsolemode Change-Id: I19feadf8da303a1ada8e517399416a4730845900 GitHub-Last-Rev: 832fc7e GitHub-Pull-Request: #14 Reviewed-on: https://go-review.googlesource.com/c/term/+/562779 Reviewed-by: Michael Pratt <[email protected]> Reviewed-by: Laurent Demailly <[email protected]> Reviewed-by: Jorropo <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Cherry Mui <[email protected]>
1 parent 30da5dd commit 27f29d8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

term_windows.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ func isTerminal(fd int) bool {
2020
return err == nil
2121
}
2222

23+
// This is intended to be used on a console input handle.
24+
// See https://learn.microsoft.com/en-us/windows/console/setconsolemode
2325
func makeRaw(fd int) (*State, error) {
2426
var st uint32
2527
if err := windows.GetConsoleMode(windows.Handle(fd), &st); err != nil {
2628
return nil, err
2729
}
28-
raw := st &^ (windows.ENABLE_ECHO_INPUT | windows.ENABLE_PROCESSED_INPUT | windows.ENABLE_LINE_INPUT | windows.ENABLE_PROCESSED_OUTPUT)
30+
raw := st &^ (windows.ENABLE_ECHO_INPUT | windows.ENABLE_PROCESSED_INPUT | windows.ENABLE_LINE_INPUT)
2931
raw |= windows.ENABLE_VIRTUAL_TERMINAL_INPUT
3032
if err := windows.SetConsoleMode(windows.Handle(fd), raw); err != nil {
3133
return nil, err

0 commit comments

Comments
 (0)