Reply to topic  [ 5 posts ] 
classic Keep on Same Line feature 
Author Message

Joined: 2007-08-21 15:14:55
Posts: 16
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


2007-08-21 15:30:16
Profile

Joined: 2008-05-17 04:02:32
Posts: 400
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:
### 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 ###


2008-09-21 07:06:36
Profile
User avatar

Joined: 2007-01-17 03:25:42
Posts: 729
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.


2008-09-21 07:34:39
Profile

Joined: 2008-05-17 04:02:32
Posts: 400
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.


2008-09-21 08:00:44
Profile
User avatar

Joined: 2007-01-17 03:25:42
Posts: 729
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.


2008-09-21 08:21:45
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software