michael@garfield.UUCP (11/05/87)
Subject: Bug in vi (v3.7) - modeline problem
Index: ex_io.c
Description:
Vi will appear to hang given a +n or +/pattern on the command line
when used with the modeline feature.
Repeat-by:
Create a file with a "vi: se wm=5:" in the first or last 5 lines.
Set modeline (i.e. "set modeline") in EXINIT or ~/.exrc or ./.exrc.
Try to start up vi with "vi +2 file". Note that it prints out the
name, line and character count and nothing else....
Fix:
Set peekc to 0 before doing the +n command in rop3() - apply
following context diff to ex_io.c.
*** ex_io.c.old Thu Nov 5 01:04:23 1987
--- ex_io.c Thu Nov 5 01:07:49 1987
***************
*** 463,471 ****
--- 463,488 ----
if (addr > dol)
addr = dol;
if (firstpat) {
+ /*
+ * Save and restore peekc/globp
+ * this is probably not needed, but
+ * is done out of paranoia. The
+ * only thing which needs to be done is
+ * to set peekc to 0. This fixes a bug
+ * that occurs when modeline is used in
+ * combination with "+n" on the command line
+ */
+ char *oglobp;
+ int savepeekc;
+
+ oglobp = globp;
+ savepeekc = peekc;
+ peekc = 0;
globp = (*firstpat) ? firstpat : "$";
commands(1,1);
firstpat = 0;
+ globp = oglobp;
+ peekc = savepeekc;
} else if (addr >= one) {
if (inopen)
dot = addr;