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

app.Stop() and app.Suspend() require an additional keypress before clearing screen #597

Closed
lukegalea opened this issue May 6, 2021 · 6 comments

Comments

@lukegalea
Copy link

Both when using app.Stop() to exit a tview application, or when using app.Suspend(), I'm finding that a second keypress is required before the user actually "sees" the app stop.

in the trivial example below, a single press of escape should exit the program... but instead, the first press of escape doesn't clear the screen nor exit the program.. but a second keypress of any kind (enter, a second escape.. whatever) does trigger the program closing and the screen clearing.

I've tried seeding the program w/ debug output (fmt.Println) to confirm that app.Stop is being called.. and it is.. it just doesn't have the desired effect.

package main

import (
	"github.com/gdamore/tcell/v2"
	"github.com/rivo/tview"
)

func main() {
	app := tview.NewApplication()

	app.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
		if event.Key() == tcell.KeyEsc {
			app.Stop()
		}
		return event
	})

	app.
		SetRoot(tview.NewTextView().SetText("Hello World"), true).
		Run()
}
@lukegalea
Copy link
Author

A colleague has confirmed for me that this is not a problem on OSX. A single press of escape clears the screen and exits the process.,

I've confirmed it to be a problem on multiple linux distros, though.

@mdom
Copy link

mdom commented May 10, 2021

This bug does also effect OpenBSD 6.8. I'm just running the hello world demo from the README page in a xterm and i need to type another key after Ctrl-C for the application to quit.

@D54
Copy link

D54 commented May 10, 2021

It also affects Linux.
Tried in Alacritty 0.7.2 and Tilix 1.9.4.

@mdom
Copy link

mdom commented May 11, 2021

This seems to be the same issue mentioned in gdamore/tcell#452 and #244. Although the work around mentioned #244 does not work on my system.

@mdom
Copy link

mdom commented May 17, 2021

This is fixed in gdamore/tcell@8f925d8 and works fine on my machine. Maybe it would be good to update the dependency on tcell to release 2.3.1?

@D54
Copy link

D54 commented May 25, 2021

I can confirm that the current version works perfectly with gdamore/tcell v2.3.3.
c723ed0 solved this issue as well, so it can be closed.

@rivo rivo closed this as completed May 31, 2021
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

No branches or pull requests

4 participants