Skip to content

Windows console fixes #12064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 6, 2015
Merged

Windows console fixes #12064

merged 1 commit into from
Apr 6, 2015

Conversation

brendandixon
Copy link
Contributor

Corrected integer size passed to Windows
Corrected DisableEcho / SetRawTerminal to not modify state
Cleaned up and made routines more idiomatic
Corrected raw mode state bits
Removed duplicate IsTerminal
Corrected off-by-one error
Minor idiomatic change

Signed-off-by: Brendan Dixon brendand@microsoft.com

Corrected integer size passed to Windows
Corrected DisableEcho / SetRawTerminal to not modify state
Cleaned up and made routines more idiomatic
Corrected raw mode state bits
Removed duplicate IsTerminal
Corrected off-by-one error
Minor idiomatic change

Signed-off-by: Brendan Dixon <brendand@microsoft.com>
@ahmetb
Copy link
Contributor

ahmetb commented Apr 3, 2015

@icecrime @tiborvass @jfrazelle Folks meet @brendandixon, our new ANSI emulation maintainer.

This change reduces panics on terminal-attached sessions a great deal (for example I haven't got one today 😄) as far as I can tell and fixes several other minor displaying problems. I really appreciate if you folks can review and try out.

I think we should take this for 1.6. (I know, this is short notice but this observably improves the quality).

@jessfraz jessfraz added this to the 1.6.0 milestone Apr 3, 2015
@jessfraz
Copy link
Contributor

jessfraz commented Apr 3, 2015

does this fix the panics?

@ahmetb
Copy link
Contributor

ahmetb commented Apr 3, 2015

@jfrazelle as far as I can tell, yeah "many of them", however we do not have a systematic way to test and we've seen that not all repro steps causes panics in everybody's computer. I remember @icecrime/@tiborvass were observing certain panics with repro steps. That's why I'd love if you guys try it out.

As I said, this visibly reduces panics on terminal attach.

@icecrime
Copy link
Contributor

icecrime commented Apr 3, 2015

My hat off to you guys: it does fix the reproducible panics I encountered. 😮 LGTM 👍

@tiborvass
Copy link
Contributor

Hey @unclejack, since you're the buffer master, would you mind taking a peek at the ANSI code (that this PR modifies) sometime? There are bunch of weird things it's doing :(

@brendandixon
Copy link
Contributor Author

I will address them. It's going to take a couple/ three days.

On Apr 3, 2015, at 3:59 PM, Tibor Vass notifications@github.com wrote:

Hey @unclejack, since you're the buffer master, would you mind taking a peek at the ANSI code (that this PR modifies) sometime? There are bunch of weird things it's doing :(


Reply to this email directly or view it on GitHub.

@jessfraz
Copy link
Contributor

jessfraz commented Apr 4, 2015

I can attest that this does not make things worse LGTM

@jessfraz
Copy link
Contributor

jessfraz commented Apr 4, 2015

also thanks so much for the hustle

@brendandixon
Copy link
Contributor Author

Well, that sets a high bar. :)

Brendan
423.922.8798
brendandixon@me.com

On Apr 3, 2015, at 5:57 PM, Jessie Frazelle notifications@github.com wrote:

I can attest that this does not make things worse LGTM


Reply to this email directly or view it on GitHub.

@LK4D4
Copy link
Contributor

LK4D4 commented Apr 4, 2015

Also @stevvooe fixed similar bufio bug in pull.

inFd = file.Fd()
isTerminalIn = IsTerminal(inFd)
}
isTerminalIn = IsConsole(inFd)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line highlights a nit I have with renaming the Terminal stuff in _windows to Console...we just end up with a mix at the two levels of abstraction that makes the code no clearer...arguably more confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, the reason I renamed them is that the concepts are sufficiently separate to avoid mixed assumptions. Consoles in Windows are only somewhat like Terminals (TTYs) in Unix / Linux. Further, since the code is part of the abstraction layer for Windows, it made most sense to use Windows-centric terms at that level and buried within the Windows files.

I'm not married to these ideas, but they motivated the name.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kk

@tiborvass
Copy link
Contributor

LGTM

@LK4D4
Copy link
Contributor

LK4D4 commented Apr 6, 2015

I should note that pkg/term/term_windows.go has wrong build-tag, it should be followed by empty line :) But it's unrelated to this change.

@brendandixon
Copy link
Contributor Author

We plan other changes to clean-up, simplify, and improve the code. I'll merge these suggestions with those changes.

@LK4D4
Copy link
Contributor

LK4D4 commented Apr 6, 2015

LGTM

jessfraz pushed a commit that referenced this pull request Apr 6, 2015
@jessfraz jessfraz merged commit 37a1658 into moby:master Apr 6, 2015
return winconsole.SetConsoleMode(fd, state.mode)
mode := state.mode
mode &^= winconsole.ENABLE_ECHO_INPUT
mode |= winconsole.ENABLE_PROCESSED_INPUT | winconsole.ENABLE_LINE_INPUT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these options don't mutate state.mode anymore, is this correct @brendandixon, @ahmetalpbalkan? I wonder if this can be a possible cause of the term resizing regression that we just detected.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code has had window resize issues. These changes did not introduce them nor expose them. The intention here is to honor the "contract" of DisableEcho as implemented by other terminal code.

@brendandixon brendandixon deleted the win-cli/rawfix branch April 8, 2015 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants