eprovst / wrap

A Fountain export tool with some extras...
GNU General Public License v3.0
62 stars 8 forks source link

Avoid breaking "--" across lines #49

Closed rnkn closed 3 years ago

rnkn commented 3 years ago

Is your feature request related to a problem? Please describe.

This is not a problem, more of an ideal-world feature. I like to frequently use -- in my scripts for an em dash, e.g.

McGarnagle pulls open the safe door -- draws his revolver --

Empty.

Every so often, this gets split across a line, which I find unattractive. This is not an issue specific to Wrap; I've found this happens with most/all screenplay programs.

Describe the solution you'd like

The string -- could be treated as word-constituent, that is, not break across lines.

Describe alternatives you've considered

Using a non-breaking hyphen (U+2011) for the first character. This requires a fair bit of fiddling when writing and is not ideal.

Additional context

If you were to accept this feature, it may prove more complex than just what I've suggested, e.g. an edge-case I can think of is what if some weirdo likes to write:

McGarnagle pulls open the safe door--draws his revolver--

In this case, I'm not sure if it means door--draws should be treated as three separate words.

One approach would be to just treat the hyphen - character as word-constituent, but then this would mean hyphenated words would cease to break across lines, which is probably not ideal.

rnkn commented 3 years ago

p.s. So I managed to get Emacs to automatically expand -- to a non-breaking hyphen followed by a regular hyphen, but when exporting to PDF via Wrap the non-breaking hyphen is displayed as a horizontal blank space, i.e.

McGarnagle pulls open the safe door  - draws his revolver  -
alerque commented 3 years ago

As long as you are using your editor to expand input, why not expand -- to an actual emdash ? I'm more familiar with book prose formats that script writing, but shouldn't an emdash be the correct input anyway? And if in scriptwriting -- is an acceptable input shortcut shouldn't the typesetter convert it to an emdash before typesetting (and hence not worry about breaking the hyphens at all)?

rnkn commented 3 years ago

@alerque this is for scriptwriting, which uses monospace output (e.g. Courier) so an em dash will appear indistinguishable from a hyphen.

alerque commented 3 years ago

I use monospace fonts literally all day long — in terminals and code editors. I'm typing this very GitHub comment in an editor¹ (Firenvim) that uses a monospace font. Emdashes are easily distinguishable from hyphens:

This — was an emdash.
This - was a hyphen.

If using a double hyphen is a standard way to input of course it should be typeset properly (not split). I also have no complaint if the relatively minor difference in dash length is not obvious enough compared to the obviousness of ana extra space block being allocated, but if your monospace font's hyphens and emdashes "appear indistinguishable" you should get a new monospace font.

¹ My view:

canvas

rnkn commented 3 years ago

@alerque this is irrelevant to scriptwriting.

eprovst commented 3 years ago

Also see #37. Yeah, line breaking is a surprisingly difficult problem. I should really find the time to work on this...

Note: these changes will not be visible in the nightly builds until the branch is merged.

eprovst commented 3 years ago

This should be fixed as of the latest nightly. Could you verify? :slightly_smiling_face: Sorry about the delay.

rnkn commented 3 years ago

Works for me! Thanks 😎