mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-09 20:44:03 -08:00
refactor: understandable offset properties
This commit is contained in:
parent
4fb33afd88
commit
9a508142fc
|
@ -3,7 +3,7 @@
|
|||
{
|
||||
"type": "prompt",
|
||||
"alignment": "right",
|
||||
"line_offset": -1,
|
||||
"vertical_offset": -1,
|
||||
"segments": [
|
||||
{
|
||||
"type": "time",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
{
|
||||
"type": "prompt",
|
||||
"alignment": "right",
|
||||
"line_offset": -1,
|
||||
"vertical_offset": -1,
|
||||
"segments": [
|
||||
{
|
||||
"type": "time",
|
||||
|
|
|
@ -111,14 +111,14 @@ func (e *engine) render() {
|
|||
fmt.Print(e.renderer.lineBreak())
|
||||
continue
|
||||
}
|
||||
if block.LineOffset != 0 {
|
||||
fmt.Print(e.renderer.changeLine(block.LineOffset))
|
||||
if block.VerticalOffset != 0 {
|
||||
fmt.Print(e.renderer.changeLine(block.VerticalOffset))
|
||||
}
|
||||
switch block.Alignment {
|
||||
case Right:
|
||||
fmt.Print(e.renderer.carriageReturn())
|
||||
blockText := e.renderBlockSegments(block)
|
||||
cursorMove := e.renderer.setCursorForRightWrite(blockText, e.settings.RightSegmentOffset)
|
||||
cursorMove := e.renderer.setCursorForRightWrite(blockText, block.VerticalOffset)
|
||||
fmt.Print(cursorMove)
|
||||
fmt.Print(blockText)
|
||||
default:
|
||||
|
|
|
@ -8,9 +8,8 @@ import (
|
|||
|
||||
//Settings holds all the theme for rendering the prompt
|
||||
type Settings struct {
|
||||
RightSegmentOffset int `json:"right_segment_offset"`
|
||||
EndSpaceEnabled bool `json:"end_space_enabled"`
|
||||
Blocks []*Block `json:"blocks"`
|
||||
EndSpaceEnabled bool `json:"end_space_enabled"`
|
||||
Blocks []*Block `json:"blocks"`
|
||||
}
|
||||
|
||||
//BlockType type of block
|
||||
|
@ -36,7 +35,8 @@ type Block struct {
|
|||
Alignment BlockAlignment `json:"alignment"`
|
||||
PowerlineSeparator string `json:"powerline_separator"`
|
||||
InvertPowerlineSeparatorColor bool `json:"invert_powerline_separator_color"`
|
||||
LineOffset int `json:"line_offset"`
|
||||
HorizontalOffset int `json:"horizontal_offset"`
|
||||
VerticalOffset int `json:"vertical_offset"`
|
||||
Segments []*Segment `json:"segments"`
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue