Classic has a feature that keeps the formatting from one paragraph to the next so that, e.g., if the first line in a paragraph starts with a tabbed indent, typing a return at the end of the paragraph starts the next paragraph with the insertion point after a leading tab.
is this possible in Pro? I have looked but cannot find a comparable setting.
I am aware that a paragraph style can be defined with an indented first line, and this can repeat automatically. That is not the solution here, however.
Cliff Bender
retain format of prev paragraph
Re: retain format of prev paragraph
Do you mean autoindent? If so, perhaps you may find the following macro useful. It supports tab, space and no-break space. Running a macro by a shortcut is definitively slower than autoindent as a built-in feature, though.
Code: Select all
$sel = TextSelection.active # get the active selection
Find Previous '(?:\n|\f|\A).*', 'E-W' # \A: document Start
$numFound = Find '^[\t\x20\xA0]+', 'Es' # s: in selection
$indent = ''
if $numFound
$indent = Read Selection
end
TextSelection.setActiveRange $sel.range # restore selection
Type Text "\n$indent"
Re: retain format of prev paragraph
The macro above does not work properly if the paragraph contains a footnote consisting of multiple paragraphs. Here is another macro which is not affected by the problem. (I have written three or four autoindent macros.)
Code: Select all
$text = TextSelection.activeText
$range = TextSelection.activeRange
$index = $limit = $range.location
$index -= 1
$indent = Cast to String "\n"
while $index >= 0 # check for charcters preceding the selection one by one from selection start to document start
$charValue = $text.characterAtIndex $index
if $charValue == 10 # if it is a newline...
break # exit from this while loop
elsif $charValue == 12 # if it is a page/section break...
break # exit from this while loop
end
$index -= 1
end
$index += 1
while $index < $limit # check for charcters between the newline/break and the selection start one by one
$charValue = $text.characterAtIndex $index
if $charValue == 9 # if it is a tab...
$indent &= Cast to String "\t" # append a tab to $indent
elsif $charValue == 32 # if it is a space...
$indent &= Cast to String "\x20" # append a space to $indent
else # if it is not a tab nor a space...
break # exit from this while loop
end
$index += 1
end
$text.replaceInRange $range, $indent # replace the current caret/selection with $indent
Re: retain format of prev paragraph
Thank you for the macros.
Setting up a style sheet or paragraph formatting with an autoindent is in many ways the preferred solution, but tabbed indentation is preferable because of how the documents will be used downstream, as basically straight text documents. Hard tabs preserve what little formatting is needed.
I guess NWPro doesn't have this very handy feature from Classic.
Setting up a style sheet or paragraph formatting with an autoindent is in many ways the preferred solution, but tabbed indentation is preferable because of how the documents will be used downstream, as basically straight text documents. Hard tabs preserve what little formatting is needed.
I guess NWPro doesn't have this very handy feature from Classic.
Re: retain format of prev paragraph
Oup! sorry, I misread your message and did not take it for a question but for a kind of complaint or a feature request. Unfortunately NW Pro does not have auto-indent. Although I had not been using it in NW Classic, I wanted to have it in NW Pro for writing macros. So I wrote several auto-indent macros but gave up using them because I could not get myself accustomed to a small time lag when executing a macro by a shortcut.credneb wrote:I guess NWPro doesn't have this very handy feature from Classic.
Re: retain format of prev paragraph
I don’t know if this meets your needs but I discovered that a kind of auto indent style can be achieved using a modified bullet list style, with the same Line Wraps (ruler) settings for all levels and an appropriate number of tabs as Bullet instead of “•”.
Edit: I was wrong in saying "not usable for writing a macro..." It was my macro for testing it which was buggy. (21:55 GMT+9:00)
As a list style, it has its limitations. You cannot use another list style in it and it seems to be impossible to set Line Wrap settings to indent wrapped lines.Edit: I was wrong in saying "not usable for writing a macro..." It was my macro for testing it which was buggy. (21:55 GMT+9:00)