[GH-ISSUE #635] Keyboard actions need to be repeated when stdin is passed #465

Closed
opened 2026-03-04 01:05:13 +03:00 by kerem · 2 comments
Owner

Originally created by @aemengo on GitHub (Aug 8, 2021).
Original GitHub issue: https://github.com/rivo/tview/issues/635

My personal project reads input from stdin. However I'm noticing that certain actions, like Ctrl-C, need to be pressed again before the effect can take place.

For example, with an application like box demo in the wiki:

package main

import "github.com/rivo/tview"

func main() {
	box := tview.NewBox().
		SetBorder(true).
		SetTitle("Box Demo")
	if err := tview.NewApplication().SetRoot(box, true).Run(); err != nil {
		panic(err)
	}
}

If I compile it and run the following, the application comes up but my first attempt at Ctrl-C does nothing.

$ go build -o box-demo main.go
$ echo hi | ./box-demo

No big deal, just curious 🙂

Originally created by @aemengo on GitHub (Aug 8, 2021). Original GitHub issue: https://github.com/rivo/tview/issues/635 My personal project reads input from **stdin**. However I'm noticing that certain actions, like `Ctrl-C`, need to be pressed again before the effect can take place. For example, with an application like *box demo* in the wiki: ```go package main import "github.com/rivo/tview" func main() { box := tview.NewBox(). SetBorder(true). SetTitle("Box Demo") if err := tview.NewApplication().SetRoot(box, true).Run(); err != nil { panic(err) } } ``` If I compile it and run the following, the application comes up but my first attempt at `Ctrl-C` does nothing. ```bash $ go build -o box-demo main.go $ echo hi | ./box-demo ``` No big deal, just curious 🙂
kerem closed this issue 2026-03-04 01:05:13 +03:00
Author
Owner

@rgrannell1 commented on GitHub (Sep 14, 2021):

For me,

go build
echo hi | ./box-demo

terminates with a single Ctrl + C. Which OS are you using?

❯ neofetch
            .-/+oossssoo+/-.               rg@rg-xps2020 
        `:+ssssssssssssssssss+:`           ------------- 
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu Impish Indri (development branch) x86_64 
    .ossssssssssssssssssdMMMNysssso.       Host: XPS 13 9300 
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Kernel: 5.13.0-14-generic 
  +ssssssssshmydMMMMMMMNddddyssssssss+     Uptime: 1 day, 5 hours, 25 mins 
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Packages: 3468 (dpkg), 49 (snap) 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Shell: zsh 5.8 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Resolution: 3440x1440 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   DE: Unity 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   WM: Mutter 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   WM Theme: Adwaita 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Theme: Yaru-dark [GTK2/3] 
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/    Icons: Yaru [GTK2/3] 
  +sssssssssdmydMMMMMMMMddddyssssssss+     Terminal: vscode 
   /ssssssssssshdmNNNNmyNMMMMhssssss/      CPU: Intel i7-1065G7 (8) @ 3.900GHz 
    .ossssssssssssssssssdMMMNysssso.       GPU: Intel Iris Plus Graphics G7 
      -+sssssssssssssssssyyyssss+-         Memory: 7137MiB / 15583MiB 
        `:+ssssssssssssssssss+:`
            .-/+oossssoo+/-.                                       
                                                                   
<!-- gh-comment-id:918714981 --> @rgrannell1 commented on GitHub (Sep 14, 2021): For me, ```bash go build echo hi | ./box-demo ``` terminates with a single `Ctrl + C`. Which OS are you using? ``` ❯ neofetch .-/+oossssoo+/-. rg@rg-xps2020 `:+ssssssssssssssssss+:` ------------- -+ssssssssssssssssssyyssss+- OS: Ubuntu Impish Indri (development branch) x86_64 .ossssssssssssssssssdMMMNysssso. Host: XPS 13 9300 /ssssssssssshdmmNNmmyNMMMMhssssss/ Kernel: 5.13.0-14-generic +ssssssssshmydMMMMMMMNddddyssssssss+ Uptime: 1 day, 5 hours, 25 mins /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/ Packages: 3468 (dpkg), 49 (snap) .ssssssssdMMMNhsssssssssshNMMMdssssssss. Shell: zsh 5.8 +sssshhhyNMMNyssssssssssssyNMMMysssssss+ Resolution: 3440x1440 ossyNMMMNyMMhsssssssssssssshmmmhssssssso DE: Unity ossyNMMMNyMMhsssssssssssssshmmmhssssssso WM: Mutter +sssshhhyNMMNyssssssssssssyNMMMysssssss+ WM Theme: Adwaita .ssssssssdMMMNhsssssssssshNMMMdssssssss. Theme: Yaru-dark [GTK2/3] /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/ Icons: Yaru [GTK2/3] +sssssssssdmydMMMMMMMMddddyssssssss+ Terminal: vscode /ssssssssssshdmNNNNmyNMMMMhssssss/ CPU: Intel i7-1065G7 (8) @ 3.900GHz .ossssssssssssssssssdMMMNysssso. GPU: Intel Iris Plus Graphics G7 -+sssssssssssssssssyyyssss+- Memory: 7137MiB / 15583MiB `:+ssssssssssssssssss+:` .-/+oossssoo+/-. ```
Author
Owner

@aemengo commented on GitHub (Sep 14, 2021):

@rgrannell1 I'm on macOS (11.5.2), but the issue seems to have resolved itself when I bumped the rivo/tview library.

-       github.com/rivo/tview v0.0.0-20210427112837-09cec83b1732
+       github.com/rivo/tview v0.0.0-20210909154944-f7430b878d17
<!-- gh-comment-id:918743287 --> @aemengo commented on GitHub (Sep 14, 2021): @rgrannell1 I'm on macOS (**11.5.2**), but the issue seems to have resolved itself when I bumped the rivo/tview library. ```diff - github.com/rivo/tview v0.0.0-20210427112837-09cec83b1732 + github.com/rivo/tview v0.0.0-20210909154944-f7430b878d17 ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#465
No description provided.