/** * @param resource $stream * @param string $str * @param integer|null $row */ protected static function saveWriteRestore($stream, $str, $row) { if ($row) { Cursor::savepos(); Cursor::rowcol($row, Misc::cols()); } fwrite($stream, $str); if ($row) { Cursor::restore(); } }