Topic: Automatic Word Wrap (1 of 1), Read 131 times
Conf: Printing, Word processing
From: Deleted User
Date: Monday, March 22, 1999 06:57 PM

Ted Green's comment in another posting about context-sensitive
keystroke macros got me thinking. He suggested that the desired effect
could be achieved, at least in part, using Vedit's template editing
macro facility. That same facility can be used, at least in part, to
achieve automatic word wrapping while editing text. Here is my

#109 = Cur_Pos
#108 = Cur_Line
Goto_Pos( #109 )
Char( Cur_Line - #108 )

After a new key has been pressed and processed, it memorizes the current
character position and line number. Then it reformats the paragraph and
returns to its original position. I assume because newline characters
under DOS/Windows take two characters (or because they not being counted
at all?), an adjustment is required when the line number after the
paragraph reformat is different from what it was before. Perhaps
someone else can explain the details of this correction and can make it
more robust so that it will work with files under other operating
systems as well.

This simple template macro takes care of cases where new text is
being typed. It does not work when text is deleted using either the DEL
key, the backspace key, or the mouse. As soon as one enters a new
character, however, the paragraph is fixed up. I suspect that by using
Prev_Key() or some other Vedit facility it would be possible to detect
those other cases also.

-- Jay Sage