Skip to content

Commit

Permalink
fix: only clear eol on Powershell
Browse files Browse the repository at this point in the history
related to #277
  • Loading branch information
JanDeDobbeleer committed Dec 27, 2020
1 parent 59282c0 commit d9cf3b0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/ansi_renderer.go
Expand Up @@ -35,11 +35,13 @@ func (r *AnsiRenderer) creset() {

func (r *AnsiRenderer) print(text string) {
r.buffer.WriteString(text)
r.clearEOL()
}

func (r *AnsiRenderer) clearEOL() {
r.buffer.WriteString(r.formats.clearOEL)
// 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 r.formats.shell == pwsh || r.formats.shell == powershell5 {
r.buffer.WriteString(r.formats.clearOEL)
}
}

func (r *AnsiRenderer) string() string {
Expand Down

0 comments on commit d9cf3b0

Please sign in to comment.