Add \s as an alias for \x20

Sometimes you want indented long strings, such as in --help output:

           "SYNTAX\
                bar\
                baz"

But it doesn't work very well. So instead you need \x20:

           "SYNTAX\
         \x20   bar\
         \x20   baz"

This doesn't make me happy tho. So instead I'd like \s:

           "SYNTAX\
           \s   bar\
           \s   baz"

Bonus points is that it correctly aligns with the ", which gives it a vertical line on the left edge of the string.

I highly recommend the indoc crate for constructing literals like this instead of using the end-of-line \ behaviour.

3 Likes

Personally, I like the idea of "just" making backslash non-newline whitespace work in order to terminate backslash newline's whitespace-eating behavior.

But it's somewhat difficult to specify for very little gain, so it's very low priority. Especially since now things like indoc! can be written in userland for an arguably better dedent experience.

3 Likes

I'd rather have backslash-space than backslash-S.

is backslash-space available?

Why not try it yourself?

This is equivalent to

"SYNTAX    bar    baz"

But I believe what you want is

"SYNTAX
    bar
    baz"

which can be written as

         "SYNTAX\
        \n    bar\
        \n    baz"
1 Like