Skip to content

Commit 022da52

Browse files
committed
2 parents 57d8259 + 3476f28 commit 022da52

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

src/Tokenizers/Tokenizer.php

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -638,25 +638,13 @@ public function replaceTabsInToken(&$token, $prefix=' ', $padding=' ', $tabWidth
638638
}
639639

640640
// Process the tab that comes after the content.
641-
$lastCurrColumn = $currColumn;
642641
$tabNum++;
643642

644643
// Move the pointer to the next tab stop.
645-
if (($currColumn % $tabWidth) === 0) {
646-
// This is the first tab, and we are already at a
647-
// tab stop, so this tab counts as a single space.
648-
$currColumn++;
649-
} else {
650-
$currColumn++;
651-
while (($currColumn % $tabWidth) !== 0) {
652-
$currColumn++;
653-
}
654-
655-
$currColumn++;
656-
}
657-
658-
$length += ($currColumn - $lastCurrColumn);
659-
$newContent .= $prefix.str_repeat($padding, ($currColumn - $lastCurrColumn - 1));
644+
$pad = ($tabWidth - ($currColumn + $tabWidth - 1) % $tabWidth);
645+
$currColumn += $pad;
646+
$length += $pad;
647+
$newContent .= $prefix.str_repeat($padding, ($pad - 1));
660648
}//end foreach
661649
}//end if
662650

0 commit comments

Comments
 (0)