|
Remove newlines and rewrap selection
[Back]
This (quick hack) macro removes all the newlines
in a selection and rewraps in the way that it fits best in the current
window size.
Usage: Select paragraph to rewrap and run macro
You can change the $wrap_margin in the macro to e.g. 80 if
you always want to wrap to 80 columns.
if ($selection_start == -1) {
beep()
return
}
replace_in_selection("\n", " ")
s = get_selection()
p = search_string(s, " ", $wrap_margin, "backward")
k = 0
end = 0
while (p != -1 && end != 1)
{
s = replace_substring(s, p, p + 1, "\n")
if (length(s) - $wrap_margin < p)
{
end = 1
}
p = search_string(s, " ",p + $wrap_margin, "backward")
}
replace_selection(s)
[Back]
Released on Wed, 21 Nov 2001
by
C. Denat
|
|