Skip to content

Commit

Permalink
feat: remove offset settings from block
Browse files Browse the repository at this point in the history
BREAKING CHANGE: this is now completely deprecated and no longer supported
  • Loading branch information
JanDeDobbeleer committed Nov 4, 2024
1 parent 0c6ab9b commit e7cbbde
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
24 changes: 11 additions & 13 deletions src/config/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 0 additions & 4 deletions src/prompt/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e7cbbde

Please sign in to comment.