Page 1 of 1

classic Keep on Same Line feature

Posted: 2007-08-21 15:30:16
by Brooke6
In NWP, I badly miss the old Classic formatting style "Keep on Same Line."

For you macro wizards out there, is it possible to imagine a macro solution/workaround for this missing feature?

Thanks,
Brooke

Re: classic Keep on Same Line feature

Posted: 2008-09-21 07:06:36
by Kino
This one-liner prevents wordwrap by inserting U+2060 (WORD JOINER).
I think it would not be a good thing to use this kind of Unicode characters for such a purpose, which, in my understanding, are intended to be used for formatting plain text. However, if such a functionality is indispensable, then nothing can prevent us. It's a personal computer, after allĀ ;-)

Code: Select all

### Keep on the Same Line ###

# This macro prevents wordwrap by inserting U+2060 (WORD JOINER)
# after "-", "/" and " " (space) WITHIN selected text(s).

# If the actual font does not have U+2060 (n/a in many fonts),
# it will be supplied by another font automatically, possibly
# causing the modification of line spacing. To prevent it, set
# the line spacing to Fixed.

# To remove U+2060, use
#    Replace All '\x{2060}', '', 'E'
# or
#    Replace All '\x{2060}', '', 'Es' # In Selection

Replace All '(?<!\G)(?<=[-/\x20])(?=\p{Any})', '\x{2060}', 'Es'
     # (?<!\G): Not selection start
     # (?=\p{Any}): Not selection end

### end of macro ###

Re: classic Keep on Same Line feature

Posted: 2008-09-21 07:34:39
by Hamid
Thank you! I made this feature request because very often, in Arabic, the last word of the paragraph flows on to the next page even when there is enough space to fit the word on the same line on the previous page. Adding a blank line after the paragraph caused the word to remain on the same line on the previous page.

Re: classic Keep on Same Line feature

Posted: 2008-09-21 08:00:44
by Kino
Hamid wrote:I made this feature request because very often, in Arabic, the last word of the paragraph flows on to the next page even when there is enough space to fit the word on the same line on the previous page.
Perhaps the macro does not solve that problem, I'm afraid. It seems to me that the culprit is a bug or some negligence in Cocoa text system's calculation of character length when there are diacritical marks.

Re: classic Keep on Same Line feature

Posted: 2008-09-21 08:21:45
by Hamid
The macro does help to refresh and correct the layout. When I run it, it corrects the layout. Then when I undo the action of the macro, the layout stays corrected.