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
x/crypto/ssh/terminal: GetSize returns incorrect results #27743
Comments
Hi, thanks for the reply. I will say what I expected was the window size. I can imagine scenarios where one may need both, but for a basic console app, I think size of the window, i.e. the viewable area, is more important. For example, if I wanted to know how much space I have for writing text, I'd need to know the dimensions (same thing for clearing the screen, unless there's a method that I haven't found yet....) The same is true for determining whether things need to be redrawn if the terminal window is resized. I noticed this library uses |
That code does not run on Windows - note how first line of that source file says // +build !windows Alex |
That was my concern. It looks, then, like the only way to get this information is sending a command such as But back to my original issue, at the least it seems like the documentation should make it clearer that |
There is no stty command on Windows, if that is what you are suggesting. Alex |
Change https://golang.org/cl/163538 mentions this issue: |
Return window size instead of buffer size. Fixes golang/go#27743 Change-Id: Ib1cd249f5680d86d505032e51d9102c2718ddf6f Reviewed-on: https://go-review.googlesource.com/c/163538 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Return window size instead of buffer size. Fixes golang/go#27743 Change-Id: Ib1cd249f5680d86d505032e51d9102c2718ddf6f Reviewed-on: https://go-review.googlesource.com/c/163538 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Return window size instead of buffer size. Fixes golang/go#27743 Change-Id: Ib1cd249f5680d86d505032e51d9102c2718ddf6f Reviewed-on: https://go-review.googlesource.com/c/163538 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Return window size instead of buffer size. Fixes golang/go#27743 Change-Id: Ib1cd249f5680d86d505032e51d9102c2718ddf6f Reviewed-on: https://go-review.googlesource.com/c/163538 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Return window size instead of buffer size. Fixes golang/go#27743 Change-Id: Ib1cd249f5680d86d505032e51d9102c2718ddf6f Reviewed-on: https://go-review.googlesource.com/c/163538 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Return window size instead of buffer size. Fixes golang/go#27743 Change-Id: Ib1cd249f5680d86d505032e51d9102c2718ddf6f Reviewed-on: https://go-review.googlesource.com/c/163538 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Return window size instead of buffer size. Fixes golang/go#27743 Change-Id: Ib1cd249f5680d86d505032e51d9102c2718ddf6f Reviewed-on: https://go-review.googlesource.com/c/163538 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Return window size instead of buffer size. Fixes golang/go#27743 Change-Id: Ib1cd249f5680d86d505032e51d9102c2718ddf6f Reviewed-on: https://go-review.googlesource.com/c/163538 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Return window size instead of buffer size. Fixes golang/go#27743 Change-Id: Ib1cd249f5680d86d505032e51d9102c2718ddf6f Reviewed-on: https://go-review.googlesource.com/c/163538 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go1.11 windows/amd64
Does this issue reproduce with the latest release?
Yes (since as far as I know this is the latest release).
What operating system and processor architecture are you using (
go env
)?Windows 10, amd64.
What did you do?
What did you expect to see?
Accurate height and width of the terminal.
What did you see instead?
Height is way off. My terminal window is 30 lines tall, but this returns a height of 9001. Width was correct, however.
In addition, I noticed that this issue remains. On Windows, getting the terminal handle via
os.Stdin.Fd()
results in an error, whileos.Stdout.Fd()
results in the above. However, on Linux, usingStdin
works properly.The text was updated successfully, but these errors were encountered: