Terminal ANSI render mode is incorrectly used to clear new lines

Originator:i.am.qix
Number:rdar://23907683 Date Originated:Dec 15, 2015
Status:Closed Resolved:Yes
Product:OSX Product Version:10.11 (15A284)
Classification:UI/User Interface Reproducible:Always
 
Summary:
When clearing a new line, the render mode used should be equivalent to `0m`. In the default terminal's case, the previous line's render mode is used (as can be seen in the attached screenshot).

Steps to Reproduce:
1. Open default terminal
2. Run `printf "\x1b[49mhello\n\x1b[mthere\n"`

Expected Results:
First line with red background "hello"; second line with default display "there"

Actual Results:
First line with red background "hello"; second line with default display "there" and all remaining columns with red background.

Version:
10.11 (15A284)

Notes:


Configuration:


Attachments:
'Screen Shot 2015-12-15 at 14.54.04.png' was successfully uploaded.

Comments

Hi; apologies.

printf "x1b[41mhellonx1b[mtheren"

49m -> 41m


As for the comment about vim, that makes sense. It just seems incorrect, but that use case makes sense.

Thank you for your response.

This issue has been verified as resolved and can be closed.

Engineering has provided the following feedback regarding this issue:

NOTE: Your example script:

  1. Run printf "\x1b[49mhello\n\x1b[mthere\n"

doesn’t demonstrate the issue with the default Bash shell prompt in either Terminal or iTerm2. It seems that it only demonstrates the reported behavior due to an interaction with your custom prompt.

As an example, BCE is what enables Vim to color the background when using a colorscheme with a specific background color, e.g. “colorscheme blue”. Without BCE the space to the right of each line would be drawn with the terminal background color.

Bug originally discovered by Martin Heidegger at https://github.com/chalk/chalk/pull/92.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!