[GH-ISSUE #130] Multiline text in a Table or List get crazy #100

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

Originally created by @KyleBanks on GitHub (Jun 8, 2018).
Original GitHub issue: https://github.com/rivo/tview/issues/130

Here's a sample program that demonstrates the issue. Basically the Table contains a number of default TableCell with a multiline string:

package main

import (
	"github.com/rivo/tview"
)

const lorem = `Lorem 
ipsum 
dolor 
sit 
amet, 
consetetur 
sadipscing 
elitr,
sed 
diam 
nonumy 
eirmod 
tempor 
invidunt 
ut 
labore 
et 
dolore 
magna 
aliquyam 
erat, 
sed 
diam 
voluptua.`

func main() {
	table := tview.NewTable().
		SetSelectable(true, true)

	for r := 0; r < 50; r++ {
		table.SetCell(r, 0, tview.NewTableCell(lorem))
	}

	app := tview.NewApplication()
	if err := app.SetRoot(table, true).Run(); err != nil {
		panic(err)
	}
}

And here are the results when the application starts, and after moving around with the up and down arrows a few times:

screen shot 2018-06-07 at 8 02 19 pm screen shot 2018-06-07 at 8 02 26 pm

Go Version: 1.10.2
OS: macOS v10.13.2
Terminal Version: 2.8

Originally created by @KyleBanks on GitHub (Jun 8, 2018). Original GitHub issue: https://github.com/rivo/tview/issues/130 Here's a sample program that demonstrates the issue. Basically the `Table` contains a number of default `TableCell` with a multiline string: ``` package main import ( "github.com/rivo/tview" ) const lorem = `Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.` func main() { table := tview.NewTable(). SetSelectable(true, true) for r := 0; r < 50; r++ { table.SetCell(r, 0, tview.NewTableCell(lorem)) } app := tview.NewApplication() if err := app.SetRoot(table, true).Run(); err != nil { panic(err) } } ``` And here are the results when the application starts, and after moving around with the up and down arrows a few times: <img width="1440" alt="screen shot 2018-06-07 at 8 02 19 pm" src="https://user-images.githubusercontent.com/2164691/41132259-0e08f354-6a8e-11e8-98c8-3f1533632db9.png"> <img width="1440" alt="screen shot 2018-06-07 at 8 02 26 pm" src="https://user-images.githubusercontent.com/2164691/41132260-0e1ab684-6a8e-11e8-93de-47cb71f0009c.png"> **Go Version**: 1.10.2 **OS**: macOS v10.13.2 **Terminal Version**: 2.8
kerem closed this issue 2026-03-04 01:01:57 +03:00
Author
Owner

@rivo commented on GitHub (Jun 9, 2018):

Thanks for spotting this. I just rolled out a fix.

Please note that Table cells can never contain multi-line text. The content of a table row is only one row on the screen. If you need a table-like structure that is more complex, you'll need to use Grid.

<!-- gh-comment-id:395961293 --> @rivo commented on GitHub (Jun 9, 2018): Thanks for spotting this. I just rolled out a fix. Please note that `Table` cells can never contain multi-line text. The content of a table row is only one row on the screen. If you need a table-like structure that is more complex, you'll need to use `Grid`.
Author
Owner

@KyleBanks commented on GitHub (Jun 9, 2018):

Awesome, thanks for the quick turnaround. I ended up switching to a large
TextView with regions and managing scrolling and selection myself, but I'll
test this out.

On Sat, Jun 9, 2018, 7:18 AM rivo, notifications@github.com wrote:

Thanks for spotting this. I just rolled out a fix.

Please note that Table cells can never contain multi-line text. The
content of a table row is only one row on the screen. If you need a
table-like structure that is more complex, you'll need to use Grid.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/rivo/tview/issues/130#issuecomment-395961293, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ACEH0yOKUcWCDvOOAviW5QsK29AgqMnbks5t6677gaJpZM4UfTXT
.

<!-- gh-comment-id:395962746 --> @KyleBanks commented on GitHub (Jun 9, 2018): Awesome, thanks for the quick turnaround. I ended up switching to a large TextView with regions and managing scrolling and selection myself, but I'll test this out. On Sat, Jun 9, 2018, 7:18 AM rivo, <notifications@github.com> wrote: > Thanks for spotting this. I just rolled out a fix. > > Please note that Table cells can never contain multi-line text. The > content of a table row is only one row on the screen. If you need a > table-like structure that is more complex, you'll need to use Grid. > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <https://github.com/rivo/tview/issues/130#issuecomment-395961293>, or mute > the thread > <https://github.com/notifications/unsubscribe-auth/ACEH0yOKUcWCDvOOAviW5QsK29AgqMnbks5t6677gaJpZM4UfTXT> > . >
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#100
No description provided.