Bug 434187

Summary: background color is not reset properly if ANSI reset code is on newline
Product: [Applications] konsole Reporter: paul <pl.gruener>
Component: emulationAssignee: Konsole Developer <konsole-devel>
Status: REPORTED ---    
Severity: minor    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Screenshot of colored command output.

Description paul 2021-03-09 14:15:17 UTC
Created attachment 136525 [details]
Screenshot of colored command output.

SUMMARY

When setting the background color via an ANSI SGR escape sequence such as '\e[41m', and the reset sequence '\e[0m' is placed on a new line, the bg-color is not reset immediately.

STEPS TO REPRODUCE

printf '\e[0mLine1\n\e[41mLine2\n\e[0mLine3\nLine4\n'

OBSERVED RESULT

see screenshot.
The word "Line2" has a colored background as expected, but the empty end of "Line3" is colored as well.

(If the reset comes after multiple newlines, only the first '\n' seems to respect the bg color, subsequent lines color the whole window width.)


EXPECTED RESULT
Only "Line2" should have a red background, same as in

printf '\e[0mLine1\n\e[41mLine2\e[0m\nLine3\nLine4\n'

On other terminal emulators such as xterm or QTerminal, there is no difference between those two commands.

SOFTWARE/OS VERSIONS
Arch-Linux, Kernel 5.11.2
KDE Plasma Version: 5.21.2
KDE Frameworks Version: 5.79.0
Qt Version: 5.15.2