[comp.editors] Vi macro strangeness

brad@b11.ingr.com (Brad Maxwell) (11/16/90)

I was playing with the recent macro to lowercase or uppercase the
last word typed and found something strange in my vi.

The macro starts something like

map! ^B  ^]bywPb....(so on and so on)

which is supposed to back up, yank the word, put it in front of itself,
and back up to the beginning again ( hello --> hello hello ).

Anyway, this much of the macro gives ( hello --> bhello hello ).  The
P command inserts the 'b' onto the line itself.  The keystrokes work
fine by themselves, and the macro was posted by someone who really
uses it.  What causes this and how do I fix it?

Any ideers are appreciated,

 Brad Maxwell

dolf@idca.tds.PHILIPS.nl (Dolf Grunbauer) (11/16/90)

In article <9400@b11.ingr.com> brad@b11.ingr.com (Brad Maxwell) writes:
>The macro starts something like
>map! ^B  ^]bywPb....(so on and so on)
>
>which is supposed to back up, yank the word, put it in front of itself,
>and back up to the beginning again ( hello --> hello hello ).
>
>Anyway, this much of the macro gives ( hello --> bhello hello ).  The
>P command inserts the 'b' onto the line itself.  The keystrokes work
>fine by themselves, and the macro was posted by someone who really
>uses it.  What causes this and how do I fix it?

Some versions of 'vi' don't support Yanks (Y, yy etc) and Puts (p, P) inside
macro's. Sometimes you get a warning, sometimes you get someting unpredictable.
My vi has the same problem :-(
-- 
   _ _ 
  / U |  Dolf Grunbauer  Tel: +31 55 433233 Internet dolf@idca.tds.philips.nl
 /__'<   Philips Information Systems        UUCP     ...!mcsun!philapd!dolf
88  |_\  If you are granted one wish do you know what to wish for right now ?

rick@tetrauk.UUCP (Rick Jones) (11/17/90)

In article <9400@b11.ingr.com> brad@b11.ingr.com (Brad Maxwell) writes:
>
>I was playing with the recent macro to lowercase or uppercase the
>last word typed and found something strange in my vi.
>
>The macro starts something like
>
>map! ^B  ^]bywPb....(so on and so on)
>
>which is supposed to back up, yank the word, put it in front of itself,
>and back up to the beginning again ( hello --> hello hello ).
>
>Anyway, this much of the macro gives ( hello --> bhello hello ).  The
>P command inserts the 'b' onto the line itself.  The keystrokes work
>fine by themselves, and the macro was posted by someone who really
>uses it.  What causes this and how do I fix it?
>
>Any ideers are appreciated,

I found this problem myself a while back, and also posted it looking for help.
It appears to be a bug in the general version of vi released with Unix V.3, and
is all to do with the macro code getting confused about what bits of its
buffers are commands and which are text.  Earlier versions of vi don't have
this problem - I was annoyed when it broke some previously working macros on my
system when I upgraded!

It seems the only real cure is to fix the source if you have it, or get another
version of vi.  I believe some versions will work if you use a named buffer
instead of the default one (e.g. put "z in front of the y and P), but mine (SCO
Unix V/386) doesn't.  A source patch was posted when I reported this, but I'm
afraid I didn't keep it (not having source code).

No doubt you will get other replies from those with more inside knowledge.

-- 
Rick Jones
Tetra Ltd.  Maidenhead, Berks, UK
rick@tetrauk.uucp	Absence of .signature is not .signature of absence