fix(prompt): reset colors before printing fillers

This commit is contained in:
L. Yeung 2024-11-07 21:54:43 +08:00 committed by Jan De Dobbeleer
parent 6402d5d488
commit 1adf542a77
2 changed files with 24 additions and 12 deletions

View file

@ -154,6 +154,7 @@ func (e *Engine) shouldFill(filler string, padLength int) (string, bool) {
}
// allow for easy color overrides and templates
terminal.SetColors("default", "default")
terminal.Write("", "", filler)
filler, lenFiller := terminal.String()
if lenFiller == 0 {

View file

@ -147,6 +147,11 @@
"description": "The duration for which the segment will be cached. This is parsed using the `time.ParseDuration` function from the Go standard library (see https://pkg.go.dev/time#ParseDuration for details).",
"pattern": "^(infinite|([0-9]+(h|m|s))+)$"
},
"filler": {
"type": "string",
"title": "Filler",
"description": "Right aligned filler text, will span the remaining width."
},
"extra_prompt": {
"type": "object",
"default": {},
@ -230,6 +235,10 @@
"hide"
],
"default": ""
},
"filler": {
"$ref": "#/definitions/filler",
"description": "https://ohmyposh.dev/docs/configuration/block#filler"
}
}
}
@ -4787,19 +4796,21 @@
"$ref": "#/definitions/extra_prompt",
"title": "Transient Prompt Setting",
"description": "https://ohmyposh.dev/docs/configuration/transient",
"properties": {
"filler": {
"type": "string",
"title": "Filler",
"description": "Right aligned filler text, will span the remaining width"
},
"newline": {
"type": "boolean",
"title": "Newline",
"description": "Add a newline before the prompt",
"default": false
"anyOf": [
{
"properties": {
"filler": {
"$ref": "#/definitions/filler"
},
"newline": {
"type": "boolean",
"title": "Newline",
"description": "Add a newline before the prompt",
"default": false
}
}
}
}
]
},
"valid_line": {
"$ref": "#/definitions/extra_prompt",