-
Notifications
You must be signed in to change notification settings - Fork 70
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
Fix control keys handling #80
base: mainline
Are you sure you want to change the base?
Conversation
log.Errorf("Error switching terminal to raw mode: %s", err) | ||
return | ||
} | ||
defer term.Restore(int(os.Stdin.Fd()), oldState) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Auto-review: this could be moved to Stop()
too, I don't have a strong preference. The behaviour doesn't change when I do it (we then need to add a new field originalTermState term.State
on the ShellSession
struct).
@@ -0,0 +1,26 @@ | |||
# Contributing to Go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Auto-review: the project doesn't seem to use "go.mod", so I blindly cloned the repository:
git clone https://github.com/golang/term.git vendor/src/golang.org/x/term
... and removed the .git
directory there.
Note: This fix works great for me and makes the "JOE" CLI editor (yes, old I know) common escape sequences to work properly and not cause random issues or shell ejection. I can't speak for the code quality, but I thumbs-up this from a functionality point of view. |
Issue #: #29
Description of changes: this change switches the terminal in "raw" mode so that it handles Ctrl+key sequences better.
stty
"manual" manipulations in the codebase could be replaced by what the "term" package does, but again, I know nothing ; I tried removing them and the behaviour doesn't changeHow I tested:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.