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: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/', '&nbsp;&nbsp;&nbsp;&nbsp;', $text);

#1

samo - August 11, 2005 - 20:45
Status:active» needs review

patch attached

AttachmentSize
codefilter_tabs.patch 581 bytes

#2

samo - August 11, 2005 - 20:46

sorry, wrong chunk.

AttachmentSize
codefilter_tabs_0.patch 848 bytes

#3

JohnAlbin - August 17, 2007 - 21:49
Status:needs review» needs work

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.

#4

alexandreracine - January 4, 2009 - 18:21

Why not just not replace the tabs?

It does that with the 6.x stable release too.

subscribing.

 
 

Drupal is a registered trademark of Dries Buytaert.