[GH-ISSUE #1089] Underline not working #792

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

Originally created by @creack on GitHub (Apr 19, 2025).
Original GitHub issue: https://github.com/rivo/tview/issues/1089

Hello,

I tried the example from the docs [yellow::u]Yellow text underlined, it shows yellow but no underline.

Other modifiers like bold/dim work fine.

I also tried directly on tcell, and it works.

	app.SetAfterDrawFunc(func(s tcell.Screen) {
		s.SetContent(0, 0, 'H', nil, tcell.StyleDefault.Underline(true))
	})

Any idea?

Originally created by @creack on GitHub (Apr 19, 2025). Original GitHub issue: https://github.com/rivo/tview/issues/1089 Hello, I tried the example from the docs `[yellow::u]Yellow text underlined`, it shows yellow but no underline. Other modifiers like bold/dim work fine. I also tried directly on tcell, and it works. ```go app.SetAfterDrawFunc(func(s tcell.Screen) { s.SetContent(0, 0, 'H', nil, tcell.StyleDefault.Underline(true)) }) ``` Any idea?
kerem closed this issue 2026-03-04 01:07:46 +03:00
Author
Owner

@rivo commented on GitHub (May 1, 2025):

Can you please post a code example, along with a screenshot? It works fine for me:

func main() {
	box := tview.NewBox().
		SetBorder(true).
		SetBorderAttributes(tcell.AttrBold).
		SetTitle("[yellow::u]Yellow text underlined")
	if err := tview.NewApplication().SetRoot(box, true).Run(); err != nil {
		panic(err)
	}
}
Image

(This is iTerm2 on macOS.)

<!-- gh-comment-id:2844699789 --> @rivo commented on GitHub (May 1, 2025): Can you please post a code example, along with a screenshot? It works fine for me: ```go func main() { box := tview.NewBox(). SetBorder(true). SetBorderAttributes(tcell.AttrBold). SetTitle("[yellow::u]Yellow text underlined") if err := tview.NewApplication().SetRoot(box, true).Run(); err != nil { panic(err) } } ``` <img width="388" alt="Image" src="https://github.com/user-attachments/assets/029f360f-c264-4150-bed1-c3d990eb8e04" /> (This is iTerm2 on macOS.)
Author
Owner

@creack commented on GitHub (May 1, 2025):

That snippet doesn't work with the default apple terminal nor ghostty.

github.com/gdamore/tcell/v2@v2.8.1
github.com/rivo/tview@v0.0.0-20250501113434-0c592cd31026

Image

Using this code though works:

package main

import (
        "github.com/gdamore/tcell/v2"
        "github.com/rivo/tview"
)

func main() {
        app := tview.NewApplication()
        app.SetAfterDrawFunc(func(s tcell.Screen) {
                s.SetContent(10, 10, 'H', nil, tcell.StyleDefault.Underline(true))
                s.SetContent(11, 10, 'e', nil, tcell.StyleDefault.Underline(true))
                s.SetContent(12, 10, 'l', nil, tcell.StyleDefault.Underline(true))
                s.SetContent(13, 10, 'l', nil, tcell.StyleDefault.Underline(true))
                s.SetContent(14, 10, 'o', nil, tcell.StyleDefault.Underline(true))
        })
        box := tview.NewBox().
                SetBorder(true).
                SetBorderAttributes(tcell.AttrBold).
                SetTitle("[yellow::u]Yellow text underlined")
        if err := app.SetRoot(box, true).Run(); err != nil {
                panic(err)
        }
        println("success")
}
Image
<!-- gh-comment-id:2844918349 --> @creack commented on GitHub (May 1, 2025): That snippet doesn't work with the default apple terminal nor ghostty. github.com/gdamore/tcell/v2@v2.8.1 github.com/rivo/tview@v0.0.0-20250501113434-0c592cd31026 <img width="829" alt="Image" src="https://github.com/user-attachments/assets/4ba2226c-a70b-4ca7-8d93-9c7c3a603e2b" /> Using this code though works: ```go package main import ( "github.com/gdamore/tcell/v2" "github.com/rivo/tview" ) func main() { app := tview.NewApplication() app.SetAfterDrawFunc(func(s tcell.Screen) { s.SetContent(10, 10, 'H', nil, tcell.StyleDefault.Underline(true)) s.SetContent(11, 10, 'e', nil, tcell.StyleDefault.Underline(true)) s.SetContent(12, 10, 'l', nil, tcell.StyleDefault.Underline(true)) s.SetContent(13, 10, 'l', nil, tcell.StyleDefault.Underline(true)) s.SetContent(14, 10, 'o', nil, tcell.StyleDefault.Underline(true)) }) box := tview.NewBox(). SetBorder(true). SetBorderAttributes(tcell.AttrBold). SetTitle("[yellow::u]Yellow text underlined") if err := app.SetRoot(box, true).Run(); err != nil { panic(err) } println("success") } ``` <img width="763" alt="Image" src="https://github.com/user-attachments/assets/df10bf41-df12-472f-986b-2e45b78039c0" />
Author
Owner

@marc-watters commented on GitHub (May 7, 2025):

I'm experiencing the same. It is related to https://github.com/gdamore/tcell. It breaks at commit 9bc5c63.

<!-- gh-comment-id:2856991715 --> @marc-watters commented on GitHub (May 7, 2025): I'm experiencing the same. It is related to https://github.com/gdamore/tcell. It breaks at commit [9bc5c63](https://github.com/gdamore/tcell/commit/9bc5c636ae92df967d0e87dbac75f587c13cc1d2).
Author
Owner

@rivo commented on GitHub (Aug 27, 2025):

The latest commit switches to tcell's new handling of the underline attribute. Can you please check if this resolves your issue and close it if it does?

<!-- gh-comment-id:3228930129 --> @rivo commented on GitHub (Aug 27, 2025): The [latest commit](https://github.com/rivo/tview/commit/aa25b822634721027b22afadb3e16144bf5f9d8b) switches to `tcell`'s new handling of the underline attribute. Can you please check if this resolves your issue and close it if it does?
Author
Owner

@creack commented on GitHub (Aug 29, 2025):

Confirmed, it works with the latest version. Thank you.

<!-- gh-comment-id:3235454545 --> @creack commented on GitHub (Aug 29, 2025): Confirmed, it works with the latest version. Thank you.
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#792
No description provided.