I'm new to Textpad...
I'm trying to make a macro that behaves a bit as EditReformat.
What I actually want is (a) replace all multiple white space in a paragraph with one space except for the initial white space at the start of the first line and (b) reformat that text to the right margin as specified by wordwrap at most but with the left margin using the indent (tabs and spaces) of the first line.
Thus (using . for a space and ---- for a tab)
Before:
----..The.quick..brown.
fox.jumps....over----the..----lazy
dog
After
----..The.quick.brown.fox
----..jumps.over.the.lazy
----..dog
Any suggestions? I'd like it to work on documents where a paragraph already has hard lineends, thus a para-end is a blank line.
Thanks.
===sgb
Paragraph reformat
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
Join all the lines of each paragraph: Edit | Join Lines (Ctrl+J).
Compress all inter-word white space into single spaces:
The regular expression above assumes you are using Posix regular expression syntax:
Compress all inter-word white space into single spaces:
Reformat the paragraphs: Edit | Reformat (Ctrl+Shift+J).Find what: ([^\t ])[\t ]+
Replace with: \1 (There's a space at the end of that.)
[X] Regular expression
The regular expression above assumes you are using Posix regular expression syntax:
Configuration | Preferences | Editor
[X] Use POSIX regular expression syntax