feat: remove offset settings from block

BREAKING CHANGE: this is now completely deprecated and no longer supported
This commit is contained in:
Jan De Dobbeleer 2024-08-05 20:35:02 +02:00 committed by Jan De Dobbeleer
parent 0c6ab9beac
commit e7cbbde984
2 changed files with 11 additions and 17 deletions

View file

@ -34,19 +34,17 @@ const (
// Block defines a part of the prompt with optional segments
type Block struct {
env runtime.Environment
Type BlockType `json:"type,omitempty" toml:"type,omitempty"`
Alignment BlockAlignment `json:"alignment,omitempty" toml:"alignment,omitempty"`
Filler string `json:"filler,omitempty" toml:"filler,omitempty"`
Overflow Overflow `json:"overflow,omitempty" toml:"overflow,omitempty"`
LeadingDiamond string `json:"leading_diamond,omitempty" toml:"leading_diamond,omitempty"`
TrailingDiamond string `json:"trailing_diamond,omitempty" toml:"trailing_diamond,omitempty"`
Segments []*Segment `json:"segments,omitempty" toml:"segments,omitempty"`
VerticalOffset int `json:"vertical_offset,omitempty" toml:"vertical_offset,omitempty"`
HorizontalOffset int `json:"horizontal_offset,omitempty" toml:"horizontal_offset,omitempty"`
MaxWidth int `json:"max_width,omitempty" toml:"max_width,omitempty"`
MinWidth int `json:"min_width,omitempty" toml:"min_width,omitempty"`
Newline bool `json:"newline,omitempty" toml:"newline,omitempty"`
env runtime.Environment
Type BlockType `json:"type,omitempty" toml:"type,omitempty"`
Alignment BlockAlignment `json:"alignment,omitempty" toml:"alignment,omitempty"`
Filler string `json:"filler,omitempty" toml:"filler,omitempty"`
Overflow Overflow `json:"overflow,omitempty" toml:"overflow,omitempty"`
LeadingDiamond string `json:"leading_diamond,omitempty" toml:"leading_diamond,omitempty"`
TrailingDiamond string `json:"trailing_diamond,omitempty" toml:"trailing_diamond,omitempty"`
Segments []*Segment `json:"segments,omitempty" toml:"segments,omitempty"`
MaxWidth int `json:"max_width,omitempty" toml:"max_width,omitempty"`
MinWidth int `json:"min_width,omitempty" toml:"min_width,omitempty"`
Newline bool `json:"newline,omitempty" toml:"newline,omitempty"`
}
func (b *Block) Init(env runtime.Environment) {

View file

@ -205,10 +205,6 @@ func (e *Engine) renderBlock(block *config.Block, cancelNewline bool) bool {
switch block.Type { //nolint:exhaustive
case config.Prompt:
if block.VerticalOffset != 0 {
e.write(terminal.ChangeLine(block.VerticalOffset))
}
if block.Alignment == config.Left {
e.currentLineLength += length
e.write(text)