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

Alternate screen doesn't clear the terminal when running in GNU Screen #116

Closed
mackstann opened this issue Jul 14, 2021 · 2 comments · Fixed by #421
Closed

Alternate screen doesn't clear the terminal when running in GNU Screen #116

mackstann opened this issue Jul 14, 2021 · 2 comments · Fixed by #421
Labels
bug Something isn't working

Comments

@mackstann
Copy link

Steps to reproduce

  1. Run GNU Screen (I'm running it in an OSX Terminal)
  2. In the bubbletea repo, go run examples/fullscreen/main.go

Expected result: Screen is cleared and you only see the countdown message

Actual result: Your terminal prompt, history, and whatever else is still visible alongside the output of the program.

However, once the program exits, the contents of the terminal are cleared.

This bug does not happen in tmux or in a bare Terminal.

Screenshot

(I ran ls just before running the program, to illustrate how it writes over top of the existing terminal contents)

Screen Shot 2021-07-13 at 9 38 44 PM

@meowgorithm meowgorithm added the bug Something isn't working label Jul 14, 2021
@meowgorithm
Copy link
Member

Thanks for this! I can replicate the behavior, though it's a bit of an interesting case here:

The alternate screen buffer is disabled by default in GNU Screen. To enable it you can press screen’s escape key (ctrl+a by default) and enter :altscreen on. After that the altscreen in Bubble Tea will behave as expected.

That said, we shouldn't be printing over existing text in the terminal like in the screenshot above. To fix this, Bubble Tea should clear the screen after the altscreen initializes, even if it doesn't initialize. For comparison, Vim, which also usually operates in an altscreen, does this.

@mackstann
Copy link
Author

Aha! Adding altscreen on to my .screenrc seems like a fine workaround -- I'm surprised it's off by default.

(I'm also surprised I've been using screen for ~20 years with this fairly standard terminal feature turned off 😮 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants