diff --git a/src/engine/block.go b/src/engine/block.go index ee2e7937..618c088e 100644 --- a/src/engine/block.go +++ b/src/engine/block.go @@ -36,14 +36,16 @@ const ( // Block defines a part of the prompt with optional segments type Block struct { - Type BlockType `json:"type,omitempty"` - Alignment BlockAlignment `json:"alignment,omitempty"` - HorizontalOffset int `json:"horizontal_offset,omitempty"` - VerticalOffset int `json:"vertical_offset,omitempty"` - Segments []*Segment `json:"segments,omitempty"` - Newline bool `json:"newline,omitempty"` - Filler string `json:"filler,omitempty"` - Overflow Overflow `json:"overflow,omitempty"` + Type BlockType `json:"type,omitempty"` + Alignment BlockAlignment `json:"alignment,omitempty"` + Segments []*Segment `json:"segments,omitempty"` + Newline bool `json:"newline,omitempty"` + Filler string `json:"filler,omitempty"` + Overflow Overflow `json:"overflow,omitempty"` + + // Deprecated: keep the logic for legacy purposes + HorizontalOffset int `json:"horizontal_offset,omitempty"` + VerticalOffset int `json:"vertical_offset,omitempty"` env environment.Environment writer color.Writer diff --git a/themes/agnosterplus.omp.json b/themes/agnosterplus.omp.json index dcf66764..a56c5ffe 100644 --- a/themes/agnosterplus.omp.json +++ b/themes/agnosterplus.omp.json @@ -2,7 +2,7 @@ "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", "blocks": [ { - "alignment": "right", + "type": "rprompt", "segments": [ { "foreground": "#007ACC", @@ -13,13 +13,10 @@ "template": " {{ .CurrentDate | date .Format }} ", "type": "time" } - ], - "type": "prompt", - "vertical_offset": -1 + ] }, { "alignment": "left", - "newline": true, "segments": [ { "background": "#ffffff", diff --git a/themes/peru.omp.json b/themes/peru.omp.json index 9bb2a8a9..ce7425c1 100644 --- a/themes/peru.omp.json +++ b/themes/peru.omp.json @@ -38,8 +38,7 @@ "type": "git" } ], - "type": "prompt", - "vertical_offset": 1 + "type": "prompt" }, { "alignment": "right", @@ -67,7 +66,7 @@ "always_enabled": true }, "style": "plain", - "template": " {{ if gt .Code 0 }}<#ff0000>\uf00d \ue23a{{ else }}<#23d18b>\uf42e \ue23a{{ end }} ", + "template": " {{ if gt .Code 0 }}<#ff0000>\uf00d{{ else }}<#23d18b>\uf42e{{ end }} ", "type": "exit" }, { diff --git a/themes/powerlevel10k_lean.omp.json b/themes/powerlevel10k_lean.omp.json index cd5f62ed..48c69e88 100644 --- a/themes/powerlevel10k_lean.omp.json +++ b/themes/powerlevel10k_lean.omp.json @@ -2,7 +2,6 @@ "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", "blocks": [ { - "alignment": "right", "segments": [ { "foreground": "#00C5C7", @@ -14,12 +13,10 @@ "type": "time" } ], - "type": "prompt", - "vertical_offset": -1 + "type": "rprompt" }, { "alignment": "left", - "newline": true, "segments": [ { "foreground": "#77E4F7", diff --git a/themes/schema.json b/themes/schema.json index 03495b15..b903c78f 100644 --- a/themes/schema.json +++ b/themes/schema.json @@ -171,16 +171,6 @@ "description": "https://ohmyposh.dev/docs/configuration/block#newline", "default": false }, - "vertical_offset": { - "type": "integer", - "title": "Block vertical offset", - "description": "https://ohmyposh.dev/docs/configuration/block#vertical-offset" - }, - "horizontal-offset": { - "type": "integer", - "title": "Block vertical offset", - "description": "https://ohmyposh.dev/docs/configuration/block#horizontal-offset" - }, "segments": { "type": "array", "title": "Segments list, prompt elements to display based on context", diff --git a/themes/unicorn.omp.json b/themes/unicorn.omp.json index 3b0d2a62..2e27e141 100644 --- a/themes/unicorn.omp.json +++ b/themes/unicorn.omp.json @@ -66,8 +66,7 @@ "type": "executiontime" } ], - "type": "prompt", - "vertical_offset": 1 + "type": "prompt" }, { "alignment": "left", diff --git a/website/docs/configuration/example.mdx b/website/docs/configuration/example.mdx index 64d6c5a2..7b2180d7 100644 --- a/website/docs/configuration/example.mdx +++ b/website/docs/configuration/example.mdx @@ -23,7 +23,6 @@ import TabItem from "@theme/TabItem" "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", "blocks": [ { - "alignment": "right", "segments": [ { "foreground": "#007ACC", @@ -35,8 +34,7 @@ import TabItem from "@theme/TabItem" "type": "time" } ], - "type": "prompt", - "vertical_offset": -1 + "type": "rprompt", }, { "alignment": "left", @@ -115,7 +113,7 @@ import TabItem from "@theme/TabItem" ```yaml # yaml-language-server: $schema=https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json blocks: -- alignment: right +- type: rprompt segments: - foreground: "#007ACC" template: " {{ .CurrentDate | date .Format }} " @@ -123,8 +121,6 @@ blocks: time_format: '15:04:05' style: plain type: time - type: prompt - vertical_offset: -1 - alignment: left newline: true segments: @@ -185,9 +181,7 @@ final_space = true version = 2 [[blocks]] -alignment = "right" -type = "prompt" -vertical_offset = -1 +type = "rprompt" [[blocks.segments]] foreground = "#007ACC"