Skip to content

Commit

Permalink
fix(pwsh): only clear console after block write
Browse files Browse the repository at this point in the history
  • Loading branch information
JanDeDobbeleer committed Apr 21, 2021
1 parent b11b69f commit 3b7b854
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@ type engine struct {

func (e *engine) write(text string) {
e.console.WriteString(text)
// Due to a bug in Powershell, the end of the line needs to be cleared.
// If this doesn't happen, the portion after the prompt gets colored in the background
// color of the line above the new input line. Clearing the line fixes this,
// but can hopefully one day be removed when this is resolved natively.
if e.ansi.shell == pwsh || e.ansi.shell == powershell5 {
e.console.WriteString(e.ansi.clearEOL)
}
}

func (e *engine) string() string {
Expand Down Expand Up @@ -86,6 +79,13 @@ func (e *engine) renderBlock(block *Block) {
case RPrompt:
e.rprompt = block.renderSegments()
}
// Due to a bug in Powershell, the end of the line needs to be cleared.
// If this doesn't happen, the portion after the prompt gets colored in the background
// color of the line above the new input line. Clearing the line fixes this,
// but can hopefully one day be removed when this is resolved natively.
if e.ansi.shell == pwsh || e.ansi.shell == powershell5 {
e.write(e.ansi.clearEOL)
}
}

// debug will loop through your config file and output the timings for each segments
Expand Down

0 comments on commit 3b7b854

Please sign in to comment.