3 minor 'vi' bugs.

chris chris at pixutl.UUCP
Wed Jul 4 01:02:12 AEST 1984


[]

   Try this: vi a file, type '^F', then '100^B', then '^G'. If
everything still looks normal, try a few more '100^B'.
   Now try that one:  ':set ht=0'.
   Finally, try ':set sw=0', then open a new line and type '^D'.

   

   The first bug is in the CTRL(b) case of vmain(), line ~= 425 in
ex_vmain.c. There are some parentheses missing in the address
calculation which causes it to get higher rather than lower when
you enter a 'n^B'. If the resulting address is greater than the
number of lines in the file, you will get an empty screen with a
cursor somewhere in the middle of it, or a core dump.

	/* original code */
	addr = dot - vcline - 2 + (cnt-1)*basWLINES;
	/* modified code */
	addr = dot - ((vcline - 2) + (cnt-1)*basWLINES);


   The second and third 'bugs' (some people may argue that setting
these values at 0 doesn't make much sense anyway, but sooner or later,
someone will try it) can be fixed easily by adding the same check for
these 2 values as the one for 'TABSTOP'. In ex_set.c, around line
100, add these lines:

			if (value(HARDTABS) <= 0)
				value(HARDTABS) = TABS;
			if (value(SHIFTWIDTH) <= 0)
				value(SHIFTWIDTH) = TABS;

after these lines:

			if (value(TABSTOP) <= 0)
				value(TABSTOP) = TABS;


   Any comments or other suggestions?


   Chris.
-- 


 Chris Bertin            :         (617) 657-8720 x2318
 Pixel Computer Inc.     :
 260 Fordham Rd.         :  {allegra|ihnp4|cbosgd|ima|genrad|amd|harvard}\
 Wilmington, Ma 01887    :     !wjh12!pixel!pixutl!chris



More information about the Net.bugs mailing list