I know long lines are bad and all, but wouldn't they be better without the horizontal scroll bars?

Sort of related to Why people do not split long lines when posting code here? - Meta Stack Overflow. (The consensus seemed to be that people were lazy or didn't notice. But there are still some legitimate reasons to have lines over 80 chars or so.)


Well, historically, because IE7 didn't support it last time this was brought up made pre-wrap an immediate no-go, as it was a supported browser at the time.

But...even now, it doesn't really address the long un-broken line of code that a scrollable area does. Pretty much, a lot of Java questions would have:

MyClassThatHandlesTheKeysTheCatAndTheCar.HeyCatNamedPicklesGoFindTheCarKeys(CarObjectWithKeyRemote petroleumPoweredManuallySteeredAutomobile1)

....that doesn't wrap correctly, but scroll bars handle it. (Test it yourself!)

Also, auto-wrapped code can be much uglier, especially when parameters and such can be manually spaced to fit the visible space in a much cleaner and more readable way.

  • -1 car1 is not a very good variable name, as it's not descriptive. – balpha Oct 8 '11 at 10:55
  • @balpha - so true, fixed! – Nick Craver Oct 8 '11 at 10:57
  • Long lines without spaces should get split when adding word-wrap: break-word. Browsers like IE7 could still fall back to scroll bars. – Lri Oct 9 '11 at 7:20
  • @Lri - again this doesn't address the "way more readable when a person spaces it out appropriately" part...that's huge, us formatting code (or attempting to, rather) will never be as good as a human, especially with such a simple CSS approach in mind. It's much better to leave it as-is, short of writing a formatting engine that handles every language... – Nick Craver Oct 9 '11 at 12:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .