Welcome to WebmasterWorld Guest from 3.80.38.5

Forum Moderators: brett tabke

Message Too Old, No Replies

TAB characters in code examples?

Textareas eliminate extra whitespace...ruins code indentations and nesting!

     
5:23 am on May 30, 2010 (gmt 0)

Junior Member

5+ Year Member

joined:May 26, 2010
posts: 92
votes: 0


Is this very readable?

for(var i = 0; i < sumthun.length; i++){
if(sumthun[i] != n){
for(var j = 0; j < sumthunelse.length; j++){
if(sumthunelse[i] < m){
switch(sumthunelse[j]){
case 0:
yeps();
break;
case 1:
nopes();
break;
default:
heckyes();
}
}
else {
return false;
}
}
}
else {
return [i,j];
}
}


Yuckiness - the nesting is gone once it's posted!
All the TAB characters I typed in my original code snippet were stripped out entirely.
The structure isn't easily noticeable...which is unfortunate for anyone venturing out into unfamiliar coding territory.

I propose the posting textarea have smart parsing which preserves whitespace (especially TAB) characters.
I don't think this is difficult to achieve on a programmatic level, and several other forums I've visited have this feature working properly.

It would be great to have this at WebmasterWorld!

[edited by: subexpression at 5:36 am (utc) on May 30, 2010]

5:35 am on May 30, 2010 (gmt 0)

Junior Member

5+ Year Member

joined:May 26, 2010
posts: 92
votes: 0


Oh yeah, I was thinking of syntax highlighting as well, but I can get by without it.

I did a quick search through the last few days and came across this post on 2010-05-25:
#4139023

Post was about syntax highlighting, but then other comments mentioned preserving whitespace characters.
It seems like others would really dig features like these.
11:02 am on May 30, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2006
posts: 3123
votes: 0


This old thread might help:
[webmasterworld.com...]
4:02 pm on May 30, 2010 (gmt 0)

Junior Member

5+ Year Member

joined:May 26, 2010
posts: 92
votes: 0


Interesting...I didn't know that these style codes existed for WebmasterWorld.
[pre][pre][/pre][/pre]


Maybe the editor toolbar should include them.

Thanks.
4:20 pm on May 30, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2006
posts: 3123
votes: 0


Just to add... although you can double space to represent a single space within PRE BB-tags, if you go back and edit your post then the double spaces will have already been reduced to a single space - so you either have to edit these back in yourself or keep your own local copy (not ideal)!
4:34 pm on May 30, 2010 (gmt 0)

Junior Member

5+ Year Member

joined:May 26, 2010
posts: 92
votes: 0


penders,

That's also good to know...hopefully only in the interim.
I'm hoping that WW will implement something like tinymce (can I say that here?).
Of course, we wouldn't need all of the features...but the editing and formatting power is tremendous.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members