To replicate

 $ yes hello | head -50 | fmt -100 > wide_lines.txt
 $ vi wide_lines.txt
 :.!fmt

correctly formats the first line as expected.  However attempting
to reformat each individual line with:

 :g/^/.!fmt
 
errors with """
+=+=+=+=+=+=+=+
Illegal address: only 6 lines in the file.
Error: unable to retrieve line 7; 4 lines added; 2 lines deleted
Press any key to continue: 
"""

(the "4 lines added; 2 lines deleted" and possibly the "Press any
key to continue" might be a screen artifact from prior to the error
message since it's not in reverse video like the rest of the error)

Expected behavior:  each individual line gets passed through fmt(1)
to reformat it.

Observed behavior:  an error about the number of lines in the file
and only a portion of the lines are properly reformatted.

It sounds like something isn't re-calculating the number of lines
in the file before/after a "!{cmd}" invocation within the context
of a :g// command.  Or perhaps the lines marked by the g:// don't
get updated after reading data output of an external "!{cmd}"

FWIW, this manifests in FreeBSD's nvi(1), too.

-tkc




Reply via email to