Skip to main content
Topic: No tab in [code][/code]? (Read 2474 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

No tab in [code][/code]?

All posted code has no tab (though actually they have tab(s)). Am I the only one seeing this?

Re: No tab in [code][/code]?

Reply #1

Which browser?

I did find an error in the wizzy code tag that will be fixed in 1.02

In testing with FF pasted and selected code retains its tabs as below:

Code: [Select]
						if (base.ieUnselectable !== false)
{
content = $(content);
content.find(':not(input,textarea)').filter(function() {return this.nodeType === 1;}).attr('unselectable', 'on');
}

Re: No tab in [code][/code]?

Reply #2

Removed the tabs in chrome for me just now when testing it.

Code: [Select]
// Check if compressed output is enabled, supported, and not already being done.
if (!empty($modSettings['enableCompressedOutput']) && !headers_sent())
{
// If zlib is being used, turn off output compression.
if (ini_get('zlib.output_compression') >= 1 || ini_get('output_handler') == 'ob_gzhandler')
$modSettings['enableCompressedOutput'] = 0;
else
{
@ob_end_clean();
ob_start('ob_gzhandler');
}
}
Success is not the result of spontaneous combustion, you must set yourself on fire!

Re: No tab in [code][/code]?

Reply #3

Does anyone remember when chrome was the cool kid?   :P

Looks like its not rendering white-space: pre for some reason.   If I look at these posts in chrome they are not tabbed, although if I select them and plop them in notepad they do have the tabs, just they are not being rendered as whitespace.  I've tried a couple of things but no luck just yet :(  Ideas anyone?

Re: No tab in [code][/code]?

Reply #4

Yes. It seems good in FF and IE. It behaves like that only in Chrome. Chrome bugs?

Re: No tab in [code][/code]?

Reply #5

It would seem, or some white space conflict somewhere in the css,.

I tried a variety of things on those spans and the container itself with no real change.  When you look at those spans in chrome dev you fill find them but they all have a width of 0px, for all I know its the font or something obscure like that.

What seems to work in chrome and FF is to do the following:
add this css below the .bbc_code declaration (note, what are there two in there, looks like a left over when something was consolidated ?)
Code: [Select]
.bbc_code .tab {
    display: inline-block;
    white-space: pre;
    width: 4ex;
}
The width + display forces chrome to have a width, and the white-space is needed for FF to preserve the tabs on a select and copy.

Then in Subs.php find
Code: (find) [Select]
$data = str_replace("\t", "<span style=\"white-space: pre;\">\t</span>", $data);
Code: (replace) [Select]
$data = str_replace("\t", "<span class=\"tab\">\t</span>", $data);

There is probably a better solution but thats all I could come up with.