fix: only clear eol on Powershell

related to #277
This commit is contained in:
Jan De Dobbeleer 2020-12-27 11:47:28 +01:00 committed by Jan De Dobbeleer
parent 59282c088d
commit d9cf3b0e40

View file

@ -35,11 +35,13 @@ func (r *AnsiRenderer) creset() {
func (r *AnsiRenderer) print(text string) { func (r *AnsiRenderer) print(text string) {
r.buffer.WriteString(text) r.buffer.WriteString(text)
r.clearEOL() // 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,
func (r *AnsiRenderer) clearEOL() { // but can hopefully one day be removed when this is resolved natively.
r.buffer.WriteString(r.formats.clearOEL) if r.formats.shell == pwsh || r.formats.shell == powershell5 {
r.buffer.WriteString(r.formats.clearOEL)
}
} }
func (r *AnsiRenderer) string() string { func (r *AnsiRenderer) string() string {