incorrect soft-wrap position

Have a problem? A question? This is the place for answers from other Express users.
Post Reply
dushanm
Posts: 9
Joined: 2013-06-25 09:05:19

incorrect soft-wrap position

Post by dushanm »

I'm using Nisus Writer Express 3.5.8b under macOS Sierra X.12.6. To print a web article I highlight it, copy it, paste it onto a new NWX window, then tweak the formatting as needed.

Once in a rare while, after pasting (but before formatting changes) I encounter a line that is soft-wrapped at the wrong spot, and I haven't been able to figure out how to correct this simply. Attached is a snippet of an RTF file that shows this problem: The first line has plenty of room on its right end (for an 8.5"x11" page) to accommodate the word 'States"', but refuses to put it there unless I place a line break after it.

What's going on? 99.9% of the time the soft-wraps are perfectly reasonable, so why the exception, and how do I correct it? Thanks.
Attachments
doubleBan-snippet.rtf
soft-wrap in wrong place
(18.4 KiB) Downloaded 1026 times
User avatar
xiamenese
Posts: 519
Joined: 2006-12-08 00:46:44
Location: London or Exeter, UK

Re: incorrect soft-wrap position

Post by xiamenese »

Just a thought. Turn on invisibles, and examine the spaces between the words that follow. As you say it's come from a web page, my guess would be that they are non-breaking spaces, rather than standard spaces. The editor on the website I'm involved with regularly does that.

Mark
User avatar
martin
Official Nisus Person
Posts: 5134
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: incorrect soft-wrap position

Post by martin »

The problem here is actually the system line wrapping rules and how they affect quoted material. The issue affects text when quotes and parentheses are adjacent like so:
Line one with "quoted
material" (followed by parenthesized text)
In situations like this the last word of the quoted text is forced to the next line, so it's alongside the parenthesized material. In the example above the word "material" is forced to be on the same line as "followed".

This is behaving correctly, at least according to Apple and the Unicode consortium. You'll see similar behavior in other apps for the same text.

If you really want to override the line wrapping you can insert an intervening character that forces a line wrap. I'd suggest a zero-width space or a zero-width non-joiner character, placed between the closing quotation and opening parenthesis.
adryan
Posts: 501
Joined: 2014-02-08 12:57:03
Location: Australia

Re: incorrect soft-wrap position

Post by adryan »

G’day, Ulrich et al

(I’m hoping Ulrich will find this contribution here rather than in the “Unwanted line break” thread he started.)

I note that the pevious posting from Martin is almost 4 years old, but it still seems to apply. When it comes to German quotation marks, though, the inconvenient line wrap occurs even in the absence of a following parenthesis.

Martin’s suggestion of using a zero-width space (accessible via the Special Characters Palette) works well. It would be more convenient if the required two-character combination (closing quotation mark followed by zero-width space) could be accessed via the Special Characters Palette, but only single characters are permitted there. Furthermore, I could not get this particular two-character substitution to work, either as a QuickFix or as a Glossary expansion, probably because they are subject to the Unicode rule Martin mentioned.

However, it does work via a Macro that places the required opening and closing quotation marks around a selection. In the following Macro code I have used the U+201F and U+201E characters for the smart quotation marks and interposed a zero-width space between the double closing quotation mark and the single straight quotation mark delimiting the replacement expression.

Code: Select all

Find and Replace '.+', '„\\0‟​', 'Esa-i'
(As an aside, I copied this code from my Macro document and did a straight Paste into the NWP document I used to write this post. Curiously, Paste Text Only resulted in deletion of the single straight quotation mark referred to above.)

Why this Macro works (ie, line wrap occurs as we wish) when the other methods do not is beyond me. A Keyboard Shortcut could be used to invoke it if desired.

Cheers,
Adrian
MacBook Pro (M1 Pro, 2021)
macOS Monterey 12.6
Nisus Writer user since 1996
Post Reply