Rather than guessing at which terminal flags should be set or cleared by
MakeRaw, this change tries to make it mirror the behaviour documented
for cfmakeraw() in the termios(3) manpage.
Fixesgolang/go#15625
Change-Id: Icd6b18ffb57ea332147c8c9b25eac5e41eb0863a
Reviewed-on: https://go-review.googlesource.com/22964
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Faiyaz Ahmed <ahmedf@vmware.com>
Reviewed-by: Adam Langley <agl@golang.org>
To facilitate testing of methods in other GOOSs we need plan9 to
be able to build and run the test without a errors due to
undefined methods.
Fixesgolang/go#15195
Change-Id: Ida334676f92db6fb4652af3e3a9f6bc13a96052c
Reviewed-on: https://go-review.googlesource.com/21711
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
SetSize has a problem may cause the following ReadPassword setting
temporary prompt not working, when changing width the current
SetSize will call clearAndRepaintLinePlusNPrevious which would
print an old prompt whatever the current line has, causing a following
ReadPassword with temporary prompt not printing the different prompt.
When running code like this, the nt.SetSize prints a "> " as
prompt then the temporary "Password: " prompt would never show up.
```go
oldState, err := terminal.MakeRaw(int(os.Stdin.Fd()))
width, height, _ = terminal.GetSize(int(os.Stdin.Fd()))
nt := terminal.NewTerminal(os.Stdin, "> ")
nt.SetSize(width, height)
password, err = nt.ReadPassword("Password: ")
```
the new test cases is to test SetSize with different terminal sizes,
either shrinking or expanding, a following ReadPassword should get the
correct temporary prompt.
Change-Id: I33d13b2c732997c0c88670d53545b8c0048b94b6
Reviewed-on: https://go-review.googlesource.com/1861
Reviewed-by: Adam Langley <agl@golang.org>
Some terminals support a mode where pasted text is bracketed by escape sequences. This is very useful for terminal applications that otherwise have no good way to tell pastes and typed text apart.
This change allows applications to enable this mode and, if the terminal supports it, will suppress autocompletes during pastes and indicate to the caller that a line came entirely from pasted text.
LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/171330043
In my notes I had Home and End down as OH and OF. But that's nonsense, they are [H and ]F.
I never noticed before because I don't have Home and End keys on my keyboard.
LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/172100043
Fixesgolang/go#9040.
(Note: can't compile or test this one prior to committing.)
LGTM=iant, bradfitz
R=bradfitz, mathias.gumz, iant
CC=golang-codereviews
https://golang.org/cl/171000043
Previously, if the current line was "empty", resizes wouldn't trigger
repaints. However, the line can be empty when the prompt is non-empty
and the code would then panic after a resize because the cursor position
was outside of the terminal.
LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/158090043
There doesn't appear to be perfect behaviour for line editing
code in the face of terminal resizing. But this change works
pretty well on xterm and gnome-terminal and certainly a lot
better than it used to.
LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/105580043
Currently the ssh/terminal package cannot be compiled under gccgo. Even though gccgo may be running on linux, its syscall package is slightly different and does not contain these constants.
This proposal resolves the issue by declaring the two constants locally, as we've done for the *BSDs.
LGTM=hanwen, iant
R=hanwen, iant, gobot
CC=golang-codereviews
https://golang.org/cl/101670043
I understand that ssh/terminal can't implement everybodys
favorite keyboard shortcuts, but I think these are very
widespread. They exist not only in Emacs or Readline, but also
in Acme and Sam. Also they almost come for free.
R=golang-dev
CC=agl, golang-dev
https://golang.org/cl/13839047
The length of history buffer entries (which are stored as strings) was
being used as the number of runes. This was correct until ff9ce887b46b,
which allowed unicode entry, but can now cause a panic when editing
history that contains non-ASCII codepoints.
R=golang-dev, sfrithjof, r
CC=golang-dev
https://golang.org/cl/13255050
Previously, terminal only supported ASCII characters. This change
alters some []byte to []rune so that the full range of Unicode is
supported. The only thing that doesn't appear to work correctly are
grapheme clusters as the code still assumes one rune per glyph. Still,
this change allows many more languages to work than did previously.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/13704043
The history buffer would recall previously entered lines: including passwords. With this change, lines entered while echo is disabled are no longer put into the history.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/10853043
terminal contains a number of utility functions that are currently only
implemented for Linux. Darwin uses different named constants for
getting and setting the terminal state so this change splits them off
as constants and defines them for each arch.
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7286043
This removes the sole "exp/foo" import in the Go subrepos.
A separate CL will remove exp/terminal from the standard Go repository.
R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/5966045