Skip to content
Myr

ci: fix linting on windows-only files (#1361)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Andrey Nering · committed by GitHub · parent 6811ae6 · Browse files · 2 files+9 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+9 added−9 removed

  • other:+9 added−9 removed

2 files+9 added−9 removed

modified:key_windows.go+5 added-5 removed
85 unmodified lines
86 err := ctx.Err()87 if err != nil {88 return fmt.Errorf("coninput context error: %w", err)89 }90 return err90 return nil91 }92 }93 }94 }
18 unmodified lines
113 button = MouseButtonBackward114 case s&coninput.FROM_LEFT_4TH_BUTTON_PRESSED > 0:115 button = MouseButtonForward116 }117 return117 return button, action118 }119120 switch {121 case btn == coninput.FROM_LEFT_1ST_BUTTON_PRESSED: // left button
24 unmodified lines
146 ev.Button, ev.Action = mouseEventButton(p, e.ButtonState)147 if ev.Action == MouseActionRelease {148 ev.Type = MouseRelease149 }150 switch ev.Button {150 switch ev.Button { //nolint:exhaustive151 case MouseButtonLeft:152 ev.Type = MouseLeft153 case MouseButtonMiddle:154 ev.Type = MouseMiddle
34 unmodified lines
189190 shiftPressed := e.ControlKeyState.Contains(coninput.SHIFT_PRESSED)191 ctrlPressed := e.ControlKeyState.Contains(coninput.LEFT_CTRL_PRESSED | coninput.RIGHT_CTRL_PRESSED)192193 switch code {193 switch code { //nolint:exhaustive194 case coninput.VK_RETURN:195 return KeyEnter196 case coninput.VK_BACK:197 return KeyBackspace
149 unmodified lines
347 case '\x1f':348 return KeyCtrlUnderscore349 }350351 switch code {351 switch code { //nolint:exhaustive352 case coninput.VK_OEM_4:353 return KeyCtrlOpenBracket354 case coninput.VK_OEM_6:355 return KeyCtrlCloseBracket
5 unmodified lines
modified:tty_windows.go+4 added-4 removed
17 unmodified lines
18 if f, ok := p.input.(term.File); ok && term.IsTerminal(f.Fd()) {19 p.ttyInput = f20 p.previousTtyInputState, err = term.MakeRaw(p.ttyInput.Fd())21 if err != nil {22 return err22 return fmt.Errorf("error making raw: %w", err)23 }2425 // Enable VT input26 var mode uint32
10 unmodified lines
37 if f, ok := p.output.(term.File); ok && term.IsTerminal(f.Fd()) {38 p.ttyOutput = f39 p.previousOutputState, err = term.GetState(f.Fd())40 if err != nil {41 return err41 return fmt.Errorf("error getting state: %w", err)42 }4344 var mode uint3245 if err := windows.GetConsoleMode(windows.Handle(p.ttyOutput.Fd()), &mode); err != nil {
4 unmodified lines
50 return fmt.Errorf("error setting console mode: %w", err)51 }52 }5354 return54 return nil55}5657// Open the Windows equivalent of a TTY.58func openInputTTY() (*os.File, error) {59 f, err := os.OpenFile("CONIN$", os.O_RDWR, 0o644)60 if err != nil {61 return nil, err61 return nil, fmt.Errorf("error opening file: %w", err)62 }63 return f, nil64}65
3 unmodified lines