Skip to content
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

Input example is leaving the console with colored text #93

Closed
sandipb opened this issue Sep 10, 2018 · 3 comments · Fixed by #104
Closed

Input example is leaving the console with colored text #93

sandipb opened this issue Sep 10, 2018 · 3 comments · Fixed by #104

Comments

@sandipb
Copy link

sandipb commented Sep 10, 2018

Suggestions

When I run go run src/github.com/c-bata/go-prompt/_example/echo/main.go the console ends up with bold text in my iterm and my xterm terminals.


Bug reports

It seems like Render.Teardown is not resetting the default colors on exit. Please let me know if I am mistaken:

 // TearDown to clear title and erasing.                                                         |   -livePrefixCallback : func() string,
 func (r *Render) TearDown() {                                                                   |   -out : ConsoleWriter
     r.out.ClearTitle()                                                                          |   -prefix : string
     r.out.EraseDown()                                                                           |   -prefixBGColor : Color
     r.out.Flush()                                                                               |   -prefixTextColor : Color
 }                                                                                               |   -previewSuggestionBGColor : Color

Should this not also include r.out.SetColor(DefaultColor, DefaultColor, false)?

Expected Behavior

The console to be back to its previous text formatting after prompt.Input() finishes.

Current Behavior and Steps to Reproduce

  1. go get -u github.com/c-bata/go-prompt
  2. go run src/github.com/c-bata/go-prompt/_example/echo/main.go

What is the current behavior? Please provide detailed steps for reproducing the issue.

If you enter your own string, the program exits as expected - with previous console colors. However, if you accept the suggestions, the program exits with bold text.

asciicast

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

  • Operating System: Mac OSX High Sierra
  • Terminal Emulator: iTerm2 and xquartx terminal
  • tag of go-prompt or commit revision: HEAD
@sandipb
Copy link
Author

sandipb commented Sep 11, 2018

It seems #85 is fixing this for me.

@c-bata
Copy link
Owner

c-bata commented Sep 11, 2018

Awesome. This report is easy to understand. I'll fix this.

@egorse
Copy link

egorse commented Sep 28, 2018

Same problem here - pretty annoying

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants