Enter image description here

I have posted the picture, and it becomes annoying reading a single lined code snippet.

I am using Chrome version 57.0.2987.133 (64-bit) on macOS v10.12 (Sierra).

Why didn't Stack Overflow do this?...

Enter image description here

  • 4
    Yeah, Apple really screwed things up there. – Oded Oct 6 '17 at 9:38
  • What prevents you from editing the code to have multiple lines instead? How your browser shows scrollbars is handled by your browser or your OS and SE can't do much about that. – Tom Oct 6 '17 at 10:52
  • @Tom On their own posts, OK. But on someone else's post, I don't think these should be edited due to the quirks of one specific browser or OS. – S.L. Barth - Reinstate Monica Oct 6 '17 at 11:41
  • 1
    @S.L.Barth Having Scrollbars in code is always annoying, not only when one use Apple software, thus I would always try to avoid them (or edit them out) (if the code readability doesn't suffer from such edit, of course). – Tom Oct 6 '17 at 11:44
  • 1
    @Tom i gave a padding-bottom of 17px and it was visible. whats the problem in doing that? – Srikanth Yashaswi Oct 6 '17 at 12:39
  • 1
    Nothing, you can do that in your own custom CSS script, if you want. – Tom Oct 6 '17 at 14:09

I, too, dislike very long single-line code snippets. While in your screenshot the behavior of the scrollbar is beyond awful, it's not a much better experience when the scrollbar behaves properly.

If at all possible (eg a language that can handle multiple lines) edit the code, adding line breaks and whatever "continuation character" is required, so that there is no scrollbar but the code remains pastable-and-usable as presented.

If that's not possible, consider editing it anyway and adding line breaks along with a note that the actual code doesn't have them. Being able to read the question or answer is really an important consideration.

| improve this answer | |
  • In some languages, whitespace has meaning. Indentation has meaning in (for example) Python and Haskell. I'd like this answer to have a warning about that. – S.L. Barth - Reinstate Monica Oct 6 '17 at 12:46
  • that's what the last paragraph was about. I don't know that a Python question needs "the line breaks were not in the original, please remove them before using this code" expanded to include "because Python treats whitespae such as line breaks as significant" -- surely if you're working in Python you know that. – Kate Gregory Oct 6 '17 at 13:28

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