Merge pull request #2269 from jesseduffield/disable-underscores-in-vscode

This commit is contained in:
Jesse Duffield 2022-11-13 13:45:08 +11:00 committed by GitHub
commit db592e1dc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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