Fix bad unit test with undefined offset (spotted by @stloyd)

This commit is contained in:
Lee McDermott 2013-01-08 03:51:15 +00:00 committed by Joseph Bielawski
parent 7f149ae0aa
commit cd1def3693

View File

@ -139,7 +139,7 @@ class DialogHelper extends Helper
} }
} elseif (ord($c) < 32) { } elseif (ord($c) < 32) {
if ("\t" === $c || "\n" === $c) { if ("\t" === $c || "\n" === $c) {
if ($numMatches > 0) { if ($numMatches > 0 && -1 !== $ofs) {
$ret = $matches[$ofs]; $ret = $matches[$ofs];
// Echo out remaining chars for current match // Echo out remaining chars for current match
$output->write(substr($ret, $i)); $output->write(substr($ret, $i));
@ -174,7 +174,7 @@ class DialogHelper extends Helper
// Erase characters from cursor to end of line // Erase characters from cursor to end of line
$output->write("\033[K"); $output->write("\033[K");
if ($numMatches > 0) { if ($numMatches > 0 && -1 !== $ofs) {
// Save cursor position // Save cursor position
$output->write("\0337"); $output->write("\0337");
// Write highlighted text // Write highlighted text