5

Today I edited an answer that interested me to try to get rid of the horizontal scroll.

You can see the final results here:

https://stackoverflow.com/a/59217352/5486

And the previous revision here:

https://stackoverflow.com/revisions/59217352/1

Despite what I thought was a decent amount of condensing effort, the horizontal scroll bar just won't go away. There's now over 18 characters' worth of space between the end of the longest line and the right edge of the window, but somehow the horizontal scroll bar won't be denied.

Why? How short does a line of code have to be to get rid of that noisome scroll bar? I could swear this situation used to be better.

1 Answer 1

9

There were a lot of trailing spaces on that answer. After trimming that, the horizontal scroll bar is gone.

I guess since some programming languages are whitespace-sensitive, not trimming it is good.

9
  • 1
    Python and Make are whitespace-sensitive, but not to trailing space. Which programming languages are sensitive to trailing space? Commented Jun 16, 2020 at 12:46
  • 1
    Huh, I spot checked a few places in the answer for trailing spaces, but I guess I wasn't as thorough as I needed to be. Thanks for finding that!
    – Ryan Lundy
    Commented Jun 16, 2020 at 12:47
  • @PeterMortensen None that I know of off the top of my head, but I'm 99.9% sure there will be an esotheric one that is, because not being trailing-space sensitive is a waste of data.
    – Erik A
    Commented Jun 16, 2020 at 12:51
  • 1
    Well, let's find out: stackoverflow.com/questions/62408971/…
    – Ryan Lundy
    Commented Jun 16, 2020 at 12:52
  • 2
    Markdown (unfortunately) has significant trailing whitespace. Commented Jun 16, 2020 at 12:55
  • @PeterMortensen True, I was thinking of that...but it's not a programming language. And it's only two spaces, right? So still anything three or more spaces could be trimmed off...
    – Ryan Lundy
    Commented Jun 16, 2020 at 12:59
  • Did some checking, I could argue SQL is trailing-space sensitive (at least: T-SQL), because it allows for multiline strings and respects trailing spaces inside strings. Similar arguments could be made for HTML (not much of a programming language though), JSX (since you can write HTML in it), and I'm sure more exist.
    – Erik A
    Commented Jun 16, 2020 at 13:15
  • @PeterMortensen Whitespace is the only one I can think of.
    – VLAZ
    Commented Jun 16, 2020 at 13:41
  • @PeterMortensen, Fortran source code written in the "fixed-form" style (such as all Fortran code before 1990, but, horrifyingly, some more recent code) must in most cases contain exactly 72 characters on a line. Many of those would be trailing blanks. I suppose one could argue that shortening lines by trimming trailing blanks would be a destructive act. Commented Jun 17, 2020 at 10:04

You must log in to answer this question.

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