fix: switch for OSC99

This commit is contained in:
Jan De Dobbeleer 2021-02-15 22:19:19 +01:00 committed by Jan De Dobbeleer
parent 853eaa3890
commit 87af930b75
4 changed files with 12 additions and 3 deletions

View file

@ -53,6 +53,7 @@ boxes with question marks, [set up your terminal][setupterm] to use a supported
## General Settings
- final_space: `boolean` - when true adds a space at the end of the prompt
- osc99: `boolean` - when true adds support for OSC9;9; (notify terminal of current working directory)
- console_title: `boolean` - when true sets the current location as the console title
- console_title_style: `string` - the title to set in the console - defaults to `folder`
- console_title_template: `string` - the template to use when `"console_title_style" = "template"`

View file

@ -164,11 +164,12 @@ func (e *engine) render() {
e.renderer.write(" ")
}
if !e.settings.OSC99 {
e.print()
return
}
cwd := e.env.getcwd()
// temp to fix 3.89 issue and add wsl support
if e.env.isWsl() {
// transform path
cwd, _ = e.env.runCommand("wslpath", "-m", cwd)
}
e.renderer.osc99(cwd)

View file

@ -11,6 +11,7 @@ import (
// Settings holds all the theme for rendering the prompt
type Settings struct {
FinalSpace bool `json:"final_space"`
OSC99 bool `json:"osc99"`
ConsoleTitle bool `json:"console_title"`
ConsoleTitleStyle ConsoleTitleStyle `json:"console_title_style"`
ConsoleTitleTemplate string `json:"console_title_template"`

View file

@ -1356,6 +1356,12 @@
"description": "https://ohmyposh.dev/docs/configure#general-settings",
"default": true
},
"osc99": {
"type": "boolean",
"title": "Enable OSC99",
"description": "https://ohmyposh.dev/docs/configure#general-settings",
"default": false
},
"console_title": {
"type": "boolean",
"title": "Console Title",