Skip to content

Commit

Permalink
hide underscores on VSCode integrated terminal while they're glitchy
Browse files Browse the repository at this point in the history
  • Loading branch information
jesseduffield committed Nov 15, 2022
1 parent 642abae commit b0cef73
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion pkg/gui/views.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
package gui

import (
"os"

"github.com/fatih/color"
"github.com/jesseduffield/gocui"
"github.com/samber/lo"
)

// 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
var (
underscoreEnvChecked bool
hideUnderscores bool
)

func hideUnderScores() bool {
if !underscoreEnvChecked {
hideUnderscores = os.Getenv("TERM_PROGRAM") == "vscode"
underscoreEnvChecked = true
}

return hideUnderscores
}

type Views struct {
// side panels
Project *gocui.View
Expand Down Expand Up @@ -155,7 +174,12 @@ func (gui *Gui) getInformationContent() string {
return informationStr
}

donate := color.New(color.FgMagenta, color.Underline).Sprint(gui.Tr.Donate)
attrs := []color.Attribute{color.FgMagenta}
if !hideUnderScores() {
attrs = append(attrs, color.Underline)
}

donate := color.New(attrs...).Sprint(gui.Tr.Donate)
return donate + " " + informationStr
}

Expand Down

0 comments on commit b0cef73

Please sign in to comment.