diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-11-13 13:35:58 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-11-13 13:41:49 +1100 |
commit | 863a65cf944440d6f82bbf37b6e5a2a7d35fcf5c (patch) | |
tree | 7946e66fef85ee4ead50a8ab8acdc6d9d397e9d7 /pkg | |
parent | 5eeaebde988c8e14a012bb8be280c1d40c590860 (diff) |
disable underscores in vscode while we wait for underscore glitch to be fixed
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/gui/style/text_style.go | 15 |
1 files changed, 15 insertions, 0 deletions
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 |