mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-25 12:24:47 +02:00
better hiding of underscores
This commit is contained in:
parent
5964472ec1
commit
a905a28e41
@ -1,20 +1,11 @@
|
||||
package style
|
||||
|
||||
import (
|
||||
"os"
|
||||
"text/template"
|
||||
|
||||
"github.com/gookit/color"
|
||||
)
|
||||
|
||||
// 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
|
||||
// duplicating because init() isn't always called when we need it
|
||||
func init() {
|
||||
HIDE_UNDERSCORES = os.Getenv("TERM_PROGRAM") == "vscode"
|
||||
}
|
||||
|
||||
var (
|
||||
FgWhite = FromBasicFg(color.FgWhite)
|
||||
FgLightWhite = FromBasicFg(color.FgLightWhite)
|
||||
|
@ -27,13 +27,21 @@ 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"
|
||||
var (
|
||||
underscoreEnvChecked bool
|
||||
hideUnderscores bool
|
||||
)
|
||||
|
||||
func hideUnderScores() bool {
|
||||
if !underscoreEnvChecked {
|
||||
hideUnderscores = os.Getenv("TERM_PROGRAM") == "vscode"
|
||||
underscoreEnvChecked = true
|
||||
}
|
||||
|
||||
return hideUnderscores
|
||||
}
|
||||
|
||||
type TextStyle struct {
|
||||
@ -75,7 +83,7 @@ func (b TextStyle) SetBold() TextStyle {
|
||||
}
|
||||
|
||||
func (b TextStyle) SetUnderline() TextStyle {
|
||||
if HIDE_UNDERSCORES {
|
||||
if hideUnderScores() {
|
||||
return b
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user