tabs do not receive proper indentation
samo - May 26, 2005 - 18:44
| Project: | Code Filter |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | patch (code needs work) |
Description
Cut-and-paste code with tabs instead of spaces is not displayed with indentation.
I'm terrible at this whole regex thing, but my fix was to add a line (line 71) after
$text = preg_replace("/^\n/", '', preg_replace('@</?(br|p)\s*/?>@', '', str_replace('\"', '"', $text)));
new line:
$text = preg_replace('/\t/', ' ', $text);

#1
patch attached
#2
sorry, wrong chunk.
#3
Blindly replacing tabs with 4 spaces won’t work, since the tabs in the middle of lines use a variable number of spots (1–4 spaces.)
Perhaps it‘s best to just replace the tabs at the beginning of lines.