[GH-ISSUE #1049] Cannot see text in text area with border set #760

Closed
opened 2026-03-04 01:07:33 +03:00 by kerem · 3 comments
Owner

Originally created by @lexagon3 on GitHub (Oct 31, 2024).
Original GitHub issue: https://github.com/rivo/tview/issues/1049

Hi there! I'm new to the library (and Go in general) so apologies if this is expected behaviour or I'm just doing something wrong!

If I add a border to a text area, the text I type is not displayed in the text area:

func main() {
	app := tview.NewApplication()
	textArea := tview.NewTextArea().SetBorder(true) // No text shown, even if set to false.
	textArea.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
		fmt.Fprintln(os.Stderr, event) // Verifying the text area does actually have focus.
		return event
	})
	if err := app.SetRoot(textArea, true).Run(); err != nil {
		panic(err)
	}
}

Removing setting the border then displays text when I type.

Thanks for your help!

Originally created by @lexagon3 on GitHub (Oct 31, 2024). Original GitHub issue: https://github.com/rivo/tview/issues/1049 Hi there! I'm new to the library (and Go in general) so apologies if this is expected behaviour or I'm just doing something wrong! If I add a border to a text area, the text I type is not displayed in the text area: ``` func main() { app := tview.NewApplication() textArea := tview.NewTextArea().SetBorder(true) // No text shown, even if set to false. textArea.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { fmt.Fprintln(os.Stderr, event) // Verifying the text area does actually have focus. return event }) if err := app.SetRoot(textArea, true).Run(); err != nil { panic(err) } } ``` Removing setting the border then displays text when I type. Thanks for your help!
kerem closed this issue 2026-03-04 01:07:33 +03:00
Author
Owner

@SamWhited commented on GitHub (Nov 3, 2024):

SetBorder returns a box, not a text area, so you're actually drawing the underlying box but not the text area itself. Modify that to:

textArea := tview.NewTextArea()
textArea.SetBorder(true)

And everything should work.

<!-- gh-comment-id:2453419037 --> @SamWhited commented on GitHub (Nov 3, 2024): `SetBorder` returns a box, not a text area, so you're actually drawing the underlying box but not the text area itself. Modify that to: ``` textArea := tview.NewTextArea() textArea.SetBorder(true) ``` And everything should work.
Author
Owner

@rivo commented on GitHub (Nov 3, 2024):

For details, see the package documentation:

https://pkg.go.dev/github.com/rivo/tview#hdr-Type_Hierarchy

<!-- gh-comment-id:2453457727 --> @rivo commented on GitHub (Nov 3, 2024): For details, see the package documentation: https://pkg.go.dev/github.com/rivo/tview#hdr-Type_Hierarchy
Author
Owner

@lexagon3 commented on GitHub (Nov 8, 2024):

Ah! I see. Thank you both for the response and clarification!

<!-- gh-comment-id:2465104338 --> @lexagon3 commented on GitHub (Nov 8, 2024): Ah! I see. Thank you both for the response and clarification!
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#760
No description provided.