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 // allow for easy color overrides and templates
terminal.SetColors("default", "default")
terminal.Write("", "", filler) terminal.Write("", "", filler)
filler, lenFiller := terminal.String() filler, lenFiller := terminal.String()
if lenFiller == 0 { 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).", "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))+)$" "pattern": "^(infinite|([0-9]+(h|m|s))+)$"
}, },
"filler": {
"type": "string",
"title": "Filler",
"description": "Right aligned filler text, will span the remaining width."
},
"extra_prompt": { "extra_prompt": {
"type": "object", "type": "object",
"default": {}, "default": {},
@ -230,6 +235,10 @@
"hide" "hide"
], ],
"default": "" "default": ""
},
"filler": {
"$ref": "#/definitions/filler",
"description": "https://ohmyposh.dev/docs/configuration/block#filler"
} }
} }
} }
@ -4787,11 +4796,11 @@
"$ref": "#/definitions/extra_prompt", "$ref": "#/definitions/extra_prompt",
"title": "Transient Prompt Setting", "title": "Transient Prompt Setting",
"description": "https://ohmyposh.dev/docs/configuration/transient", "description": "https://ohmyposh.dev/docs/configuration/transient",
"anyOf": [
{
"properties": { "properties": {
"filler": { "filler": {
"type": "string", "$ref": "#/definitions/filler"
"title": "Filler",
"description": "Right aligned filler text, will span the remaining width"
}, },
"newline": { "newline": {
"type": "boolean", "type": "boolean",
@ -4800,6 +4809,8 @@
"default": false "default": false
} }
} }
}
]
}, },
"valid_line": { "valid_line": {
"$ref": "#/definitions/extra_prompt", "$ref": "#/definitions/extra_prompt",