This site makes extensive use of JavaScript.
Please enable JavaScript in your browser.
Live
PTR
10.2.7
PTR
10.2.6
Beta
[Suggestion] [code] tag CSS
Post Reply
Return to board index
Post by
pelf
Check out this topic:
http://www.wowhead.com/?forums&topic=24796&#p221116
I'd like to suggest you add
white-space: normal;
to the class
pre.code
in global.css so that the stuff in the \ tag's <pre> element wraps even if there isn't a line break in it.
Obviously the idea with <pre> is that it shows the text exactly as it's typed -- spaces, tabs, breaks and all. In this case, though, I find having to scroll on extra long lines pretty annoying.
What do you think?
Post by
pelf
Hey, while you're at it, you could add the inline tag that converts to <span> :).
Okay that's not necessary, I guess :\.
Post by
pelf
I know you read all of these but don't always respond and whatnot, but what's your actual opinion on how the code block should work? Do you think preserving the text as it is explicitly is more important than making it not scroll within the <pre>?
Post by
Skosiris
Working as intended.
Post by
pelf
Working as intended.
Yeah I figured you'd say that. I guess I can greasemonkey it.
Post by
pelf
I'm going to bring this up again because, over in the UI&M forums, there is a growing number of people who don't use the code tag because of the way that it...
Spans the width of the post, even if the content isn't that wide.
Requires you to scroll if the content goes farther than the width of the post.
There are a lot of macros that are complex enough, within the 255 characters, that the scrolling will start on most people's resolutions. A solution is to add some returns, but that makes the macro syntactically incorrect, in some cases, so if someone just copy/pastes the macro, it won't work for them.
I'd ask you to reconsider this and perhaps the width setting on the code tag as well. Preserving line breaks literally and not showing one where one is not, I can understand, but it makes it difficult in some situations to clearly convey a code snippet. You guys are pretty smart with CSS, isn't there a way to set it so that, if a line auto-wraps, there is an automatic indent applied to that line?
Anyhow, let me know if you change your mind upon further consideration.
Post by
Wildhorn
Yes please. Make code tag to auto return. It is painful to scroll 10 kilometers to see the end of the macro.
Post by
RedwoodElf
Not to mention that you can't click-and-drag to select just the long line if there's nothing after it in the tag.
An example:
You can select this line
But you can't select both lines because this one goes all the way past the end of the row, and you can only select what's actualy in the window, since the window won't autoscroll on a drag.
Post by
cudgel
I support this change for all the reasons mentioned.
Also, it will do my OCD a world of good to see code in a fixed-width font again. :)
Post by
Wildhorn
Actually RedwoodElf, it autoscroll :P I can select both line.
Post by
PessimiStick
Actually RedwoodElf, it autoscroll :P I can select both line.
Indeed, I can select it just fine.
As for the topic, leave the code tags alone. If you want it to wrap, use quote.
Paste:
You can select this line
But you can't select both lines because this one goes all the way past the end of the row, and you can only select what's actualy in the window, since the window won't autoscroll on a drag.
Post by
Skyfire
The only way to make pre add wrapping is to use CSS3 (white-space: pre-wrap), which I'm not sure we want to do...
Post by
pelf
The only way to make pre add wrapping is to use CSS3 (white-space: pre-wrap), which I'm not sure we want to do...
Well, what I said in the first post, adding
white-space: normal;
, seems to do it. At least, when I use Firebug and add that inline to one of the PRE containers, it works for me. I don't know about how to do the hanging indent.
EDIT
:
text-indent
with some margin/padding adjustments seems to work, but only for the entire block, so unless you programmatically divided each line into a separate block within the PRE, I guess that probably wouldn't work.
Post by
Gryphon
The code tag is meant to show a fixed format, it is like this anywhere you post code. What you post will be viewed the same for everyone regardless of resolution, this is typical use of the code tag. Anyone who wants it to be like the quote tags doesn't do much programming.
Post by
pelf
The code tag is meant to show a fixed format, it is like this anywhere you post code. What you post will be viewed the same for everyone regardless of resolution, this is typical use of the code tag. Anyone who wants it to be like the quote tags doesn't do much programming.
I don't think fixed format precludes wrapping, do you? When I'm coding I certainly don't have line wrapping on, but considering the \ tag, in the context of these forums, is intended to
present
code for analysis or use by other people, it would seem that some consideration should be given for the ease by which it can be viewed or copied.
Given that, making it visually appealing by not spanning the whole width of the post when the content is smaller and making lines wrap instead of producing an internal scrollbar on an HTML block element seem to be quite reasonable.
I'm not sure what you were reading to reply with "The code tag is meant to show a fixed format, it is like this anywhere you post code. What you post will be viewed the same for everyone regardless of resolution, this is typical use of the code tag." as I don't think any of the comments and the tenets you expressed are mutually exclusive.
Post by
Wanderingfox
Simple solution is to add a tag that functions as a fixed-width quote tag.
Post by
RedwoodElf
Actually RedwoodElf, it autoscroll :P I can select both line.
Indeed, I can select it just fine.
As for the topic, leave the code tags alone. If you want it to wrap, use quote.
Paste:
You can select this line
But you can't select both lines because this one goes all the way past the end of the row, and you can only select what's actualy in the window, since the window won't autoscroll on a drag.
Must be the way Explorer implements the tag then, cause I can't.
"You can select this lineBut you can't select both lines because this one goes all the way past the end of the row, and "
thats all I get when I try to select both lines.
Post by
Fulgorater
go get chrome or firefox?
Post by
TheReal
go get chrome or firefox?
I dragged both the above lines just fine, and I use Firefox.
Post by
warrigt
how about a tag since the tag is so sacred and can't be touched lest 1000 cows be slaughtered.
Post Reply
You are not logged in. Please
log in
to post a reply or
register
if you don't already have an account.