mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-14 15:04:03 -08:00
feat(osc): remove OSC99 from config
BREAKING CHANGE: this requires to set `pwd: OSC99` instead of `OSC99: true`
This commit is contained in:
parent
d4b86e63e4
commit
0c6ab9beac
|
@ -64,7 +64,6 @@ Exports the config to an image file using customized output options.`,
|
|||
// set sane defaults for things we don't print
|
||||
cfg.ConsoleTitleTemplate = ""
|
||||
cfg.PWD = ""
|
||||
cfg.OSC99 = false
|
||||
|
||||
// add variables to the environment
|
||||
env.Var = cfg.Var
|
||||
|
|
|
@ -44,7 +44,6 @@ type Config struct {
|
|||
Version int `json:"version" toml:"version"`
|
||||
DisableNotice bool `json:"disable_notice,omitempty" toml:"disable_notice,omitempty"`
|
||||
AutoUpgrade bool `json:"auto_upgrade,omitempty" toml:"auto_upgrade,omitempty"`
|
||||
OSC99 bool `json:"osc99,omitempty" toml:"osc99,omitempty"`
|
||||
ShellIntegration bool `json:"shell_integration,omitempty" toml:"shell_integration,omitempty"`
|
||||
MigrateGlyphs bool `json:"-" toml:"-"`
|
||||
PatchPwshBleed bool `json:"patch_pwsh_bleed,omitempty" toml:"patch_pwsh_bleed,omitempty"`
|
||||
|
|
|
@ -68,7 +68,7 @@ func (e *Engine) canWriteRightBlock(length int, rprompt bool) (int, bool) {
|
|||
|
||||
func (e *Engine) pwd() {
|
||||
// only print when relevant
|
||||
if len(e.Config.PWD) == 0 && !e.Config.OSC99 {
|
||||
if len(e.Config.PWD) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -83,12 +83,6 @@ func (e *Engine) pwd() {
|
|||
pwd = strings.ReplaceAll(pwd, `\`, `/`)
|
||||
}
|
||||
|
||||
// Backwards compatibility for deprecated OSC99
|
||||
if e.Config.OSC99 {
|
||||
e.write(terminal.Pwd(terminal.OSC99, "", "", pwd))
|
||||
return
|
||||
}
|
||||
|
||||
// Allow template logic to define when to enable the PWD (when supported)
|
||||
tmpl := &template.Text{
|
||||
Template: e.Config.PWD,
|
||||
|
|
|
@ -56,14 +56,12 @@ func TestPrintPWD(t *testing.T) {
|
|||
Pwd string
|
||||
Shell string
|
||||
Cygwin bool
|
||||
OSC99 bool
|
||||
}{
|
||||
{Case: "Empty PWD"},
|
||||
{Case: "OSC99", Config: terminal.OSC99, Expected: "\x1b]9;9;pwd\x1b\\"},
|
||||
{Case: "OSC99 - Elvish", Config: terminal.OSC99, Shell: shell.ELVISH},
|
||||
{Case: "OSC7", Config: terminal.OSC7, Expected: "\x1b]7;file://host/pwd\x1b\\"},
|
||||
{Case: "OSC51", Config: terminal.OSC51, Expected: "\x1b]51;Auser@host:pwd\x1b\\"},
|
||||
{Case: "Deprecated OSC99", OSC99: true, Expected: "\x1b]9;9;pwd\x1b\\"},
|
||||
{Case: "Template (empty)", Config: "{{ if eq .Shell \"pwsh\" }}osc7{{ end }}"},
|
||||
{Case: "Template (non empty)", Config: "{{ if eq .Shell \"shell\" }}osc7{{ end }}", Expected: "\x1b]7;file://host/pwd\x1b\\"},
|
||||
{
|
||||
|
@ -104,8 +102,7 @@ func TestPrintPWD(t *testing.T) {
|
|||
engine := &Engine{
|
||||
Env: env,
|
||||
Config: &config.Config{
|
||||
PWD: tc.Config,
|
||||
OSC99: tc.OSC99,
|
||||
PWD: tc.Config,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
package segments
|
||||
|
||||
const spotifyCacheKey = "spotify_music_player"
|
||||
|
||||
func (s *Spotify) Enabled() bool {
|
||||
// Check if running
|
||||
running := s.runAppleScriptCommand("application \"Spotify\" is running")
|
||||
|
|
Loading…
Reference in a new issue