Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge pull request zendframework/zendframework#4168 from Thinkscape/h…
Browse files Browse the repository at this point in the history
…otfix/console-writeline

Fix zendframework/zendframework#4167 - Console posix adapter writeLine() background color bleeding through to the next line.
  • Loading branch information
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Adapter/Posix.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,24 @@ class Posix extends AbstractAdapter
*/
protected $lastTTYMode = null;

/**
* Write a single line of text to console and advance cursor to the next line.
*
* This override works around a bug in some terminals that cause the background color
* to fill the next line after EOL. To remedy this, we are sending the colored string with
* appropriate color reset sequences before sending EOL character.
*
* @link https://github.com/zendframework/zf2/issues/4167
* @param string $text
* @param null|int $color
* @param null|int $bgColor
*/
public function writeLine($text = "", $color = null, $bgColor = null)
{
$this->write($text, $color, $bgColor);
$this->write(PHP_EOL);
}

/**
* Determine and return current console width.
*
Expand Down

0 comments on commit ef4bc21

Please sign in to comment.