Skip to content

Commit

Permalink
fix(block): do not print newline when empty
Browse files Browse the repository at this point in the history
  • Loading branch information
JanDeDobbeleer committed Nov 4, 2024
1 parent 225f6c6 commit 014dc08
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/prompt/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@ func (e *Engine) getTitleTemplateText() string {
}

func (e *Engine) renderBlock(block *config.Block, cancelNewline bool) bool {
text, length := e.writeBlockSegments(block)

// do not print anything when we don't have any text
if length == 0 {
return false
}

defer e.applyPowerShellBleedPatch()

// do not print a newline to avoid a leading space
Expand All @@ -175,13 +182,6 @@ func (e *Engine) renderBlock(block *config.Block, cancelNewline bool) bool {
e.writeNewline()
}

text, length := e.writeBlockSegments(block)

// do not print anything when we don't have any text
if length == 0 {
return false
}

switch block.Type {
case config.Prompt:
if block.Alignment == config.Left {
Expand Down

0 comments on commit 014dc08

Please sign in to comment.