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

Lost a key event once when exiting or suspending in v2.2.1. #452

Closed
noborus opened this issue Apr 25, 2021 · 3 comments
Closed

Lost a key event once when exiting or suspending in v2.2.1. #452

noborus opened this issue Apr 25, 2021 · 3 comments

Comments

@noborus
Copy link
Contributor

@noborus noborus commented Apr 25, 2021

For example, _demos/mouse.go.
It didn't finish until I pressed the ESC key twice and then pressed any key (or moving the mouse cursor)
(same for suspend).

The cause is that a read block occurs in the inputLoop of tscreen.go.

func (t *tScreen) inputLoop(stopQ chan struct{}) {

	defer t.wg.Done()
	for {
		select {
		case <-stopQ:
			return
		default:
		}
		chunk := make([]byte, 128)
		n, e := t.in.Read(chunk)        // <------ block

(In v2.2.0, it was os.Stdin, so it could be finished.)
I'm trying on Linux (Ubuntu).

noborus added a commit to noborus/tcell that referenced this issue Apr 25, 2021
fixed gdamore#452.
When switching nonBlocking, a dummy input is sent to process read
and clear the read block.
tslocum added a commit to tslocum/tcell that referenced this issue Apr 25, 2021
tslocum added a commit to tslocum/tcell that referenced this issue Apr 25, 2021
@gdamore
Copy link
Owner

@gdamore gdamore commented Apr 25, 2021

@gdamore
Copy link
Owner

@gdamore gdamore commented May 15, 2021

Please see the tty branch for a possible fix.

gdamore added a commit that referenced this issue May 15, 2021
fixes #449 Lost keyboard input after suspend on Windows 10 PowerShell
fixes #148 Make tcell usable with any io.Reader and io.Writer

This introduces a new Tty interface so that applications can supply
their own implementation.  This should facilitate work for applications
that wish to provide e.g. a webasm version of the terminal, or that need
to use different kinds of file plumbing.
@gdamore gdamore closed this in 97c0480 May 16, 2021
@noborus
Copy link
Contributor Author

@noborus noborus commented May 17, 2021

Thank you very much.
It works fine in my environment.

noborus added a commit to noborus/ov that referenced this issue May 17, 2021
The issue at gdamore/tcell#452
has been resolved, so I updated to 2.3.1.
zyedidia added a commit to micro-editor/tcell that referenced this issue Jun 24, 2021
hhirtz added a commit to hhirtz/senpai that referenced this issue Aug 6, 2021
tcell 2.2.1 has a bug [0][1][2] that made senpai need a keypress after
Ctrl-C was hit.

[0] gdamore/tcell#452
[1] gdamore/tcell#454
[2] gdamore/tcell@7694d90
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants