diff --git a/pkg/gui/style/text_style.go b/pkg/gui/style/text_style.go index 30fa74035..14fac379b 100644 --- a/pkg/gui/style/text_style.go +++ b/pkg/gui/style/text_style.go @@ -1,6 +1,8 @@ package style import ( + "os" + "github.com/gookit/color" ) @@ -25,6 +27,15 @@ import ( // a string, we derive it when a new TextStyle is created and store it in the // `style` field. +var HIDE_UNDERSCORES bool + +// See https://github.com/xtermjs/xterm.js/issues/4238 +// VSCode is soon to fix this in an upcoming update. +// Once that's done, we can scrap the HIDE_UNDERSCORES variable +func init() { + HIDE_UNDERSCORES = os.Getenv("TERM_PROGRAM") == "vscode" +} + type TextStyle struct { fg *Color bg *Color @@ -64,6 +75,10 @@ func (b TextStyle) SetBold() TextStyle { } func (b TextStyle) SetUnderline() TextStyle { + if HIDE_UNDERSCORES { + return b + } + b.decoration.SetUnderline() b.Style = b.deriveStyle() return b