[GH-ISSUE #515] app.Suspend - read os.Stdin #374

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

Originally created by @JCzz on GitHub (Oct 16, 2020).
Original GitHub issue: https://github.com/rivo/tview/issues/515

Nice work

Can you see why I need to hit enter twice to return from suspend?

package main

import (
	"bufio"
	"fmt"
	"os"

	"github.com/rivo/tview"
)

func main() {

	app := tview.NewApplication()
	button := tview.NewButton("Hit Enter").SetSelectedFunc(func() {
		app.Suspend(func() {
			reader := bufio.NewReader(os.Stdin)
			fmt.Print("Enter text: ")
			reader.ReadString('\n')
		})
	})
	button.SetBorder(true).SetRect(0, 0, 22, 3)
	if err := app.SetRoot(button, false).Run(); err != nil {
		panic(err)
	}
}
Originally created by @JCzz on GitHub (Oct 16, 2020). Original GitHub issue: https://github.com/rivo/tview/issues/515 Nice work Can you see why I need to hit enter twice to return from suspend? ``` package main import ( "bufio" "fmt" "os" "github.com/rivo/tview" ) func main() { app := tview.NewApplication() button := tview.NewButton("Hit Enter").SetSelectedFunc(func() { app.Suspend(func() { reader := bufio.NewReader(os.Stdin) fmt.Print("Enter text: ") reader.ReadString('\n') }) }) button.SetBorder(true).SetRect(0, 0, 22, 3) if err := app.SetRoot(button, false).Run(); err != nil { panic(err) } } ```
kerem closed this issue 2026-03-04 01:04:26 +03:00
Author
Owner

@tslocum commented on GitHub (Nov 12, 2020):

This is a known bug. https://github.com/gdamore/tcell/issues/194

<!-- gh-comment-id:726358246 --> @tslocum commented on GitHub (Nov 12, 2020): This is a known bug. https://github.com/gdamore/tcell/issues/194
Author
Owner

@rivo commented on GitHub (Dec 4, 2020):

This will be resolved once the tcell bug is fixed. So I'm closing this issue as there's nothing I can do about this.

<!-- gh-comment-id:738968142 --> @rivo commented on GitHub (Dec 4, 2020): This will be resolved once the `tcell` bug is fixed. So I'm closing this issue as there's nothing I can do about this.
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#374
No description provided.