Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

I'd agree that wrapping at dashes probably doesn't make sense in code, but wrapping in general is desirable, for example:

If you want to store a constant (such as π) in Java, you should declare it public static final float MY_CONSTANT_NAME.

The type for an iterator over a const vector​<my_item_type> in C++ is vector​<my_item_type>​::​const_iterator, but these days you'd be better off using auto than typing all that. (note that I added zero-width spaces to explicitly allow line wrapping here)

Unfortunately, those requirements make what you're asking for non-trivial to implement (see http://stackoverflow.com/a/8755071/1180785https://stackoverflow.com/a/8755071/1180785).


  

So what can you do right now?

The unicode character Non-Breaking-Hyphen (\u2011) prevents this behaviour (in fact this is its reason for being). It's not copy+paste friendly since it wouldn't work as code, but for just showing a token name in a description (as seen in your example) it would be fine:

Here's a long line which will (hopefully, and depending on your device) -wraparoundtothenextlineinthisblock (using standard dash -)

Here's a long line which will (hopefully, and depending on your device) ‑wraparoundtothenextlineinthisblock (using \u2011 )

I'd agree that wrapping at dashes probably doesn't make sense in code, but wrapping in general is desirable, for example:

If you want to store a constant (such as π) in Java, you should declare it public static final float MY_CONSTANT_NAME.

The type for an iterator over a const vector​<my_item_type> in C++ is vector​<my_item_type>​::​const_iterator, but these days you'd be better off using auto than typing all that. (note that I added zero-width spaces to explicitly allow line wrapping here)

Unfortunately, those requirements make what you're asking for non-trivial to implement (see http://stackoverflow.com/a/8755071/1180785).


 

So what can you do right now?

The unicode character Non-Breaking-Hyphen (\u2011) prevents this behaviour (in fact this is its reason for being). It's not copy+paste friendly since it wouldn't work as code, but for just showing a token name in a description (as seen in your example) it would be fine:

Here's a long line which will (hopefully, and depending on your device) -wraparoundtothenextlineinthisblock (using standard dash -)

Here's a long line which will (hopefully, and depending on your device) ‑wraparoundtothenextlineinthisblock (using \u2011 )

I'd agree that wrapping at dashes probably doesn't make sense in code, but wrapping in general is desirable, for example:

If you want to store a constant (such as π) in Java, you should declare it public static final float MY_CONSTANT_NAME.

The type for an iterator over a const vector​<my_item_type> in C++ is vector​<my_item_type>​::​const_iterator, but these days you'd be better off using auto than typing all that. (note that I added zero-width spaces to explicitly allow line wrapping here)

Unfortunately, those requirements make what you're asking for non-trivial to implement (see https://stackoverflow.com/a/8755071/1180785).

 

So what can you do right now?

The unicode character Non-Breaking-Hyphen (\u2011) prevents this behaviour (in fact this is its reason for being). It's not copy+paste friendly since it wouldn't work as code, but for just showing a token name in a description (as seen in your example) it would be fine:

Here's a long line which will (hopefully, and depending on your device) -wraparoundtothenextlineinthisblock (using standard dash -)

Here's a long line which will (hopefully, and depending on your device) ‑wraparoundtothenextlineinthisblock (using \u2011 )

Source Link
Dave
  • 46.1k
  • 14
  • 9

I'd agree that wrapping at dashes probably doesn't make sense in code, but wrapping in general is desirable, for example:

If you want to store a constant (such as π) in Java, you should declare it public static final float MY_CONSTANT_NAME.

The type for an iterator over a const vector​<my_item_type> in C++ is vector​<my_item_type>​::​const_iterator, but these days you'd be better off using auto than typing all that. (note that I added zero-width spaces to explicitly allow line wrapping here)

Unfortunately, those requirements make what you're asking for non-trivial to implement (see http://stackoverflow.com/a/8755071/1180785).


So what can you do right now?

The unicode character Non-Breaking-Hyphen (\u2011) prevents this behaviour (in fact this is its reason for being). It's not copy+paste friendly since it wouldn't work as code, but for just showing a token name in a description (as seen in your example) it would be fine:

Here's a long line which will (hopefully, and depending on your device) -wraparoundtothenextlineinthisblock (using standard dash -)

Here's a long line which will (hopefully, and depending on your device) ‑wraparoundtothenextlineinthisblock (using \u2011 )