🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

3 total messages Started by chris Tue, 03 Jul 1984 15:02
3 minor 'vi' bugs.
#231
Author: chris
Date: Tue, 03 Jul 1984 15:02
50 lines
2065 bytes
[]

   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
Re: 3 minor 'vi' bugs.
#233
Author: W Stevens
Date: Mon, 09 Jul 1984 17:41
28 lines
1411 bytes
>    >   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 ...
>    >
>    >	/* original code */
>    >	addr = dot - vcline - 2 + (cnt-1)*basWLINES;
>    >	/* modified code */
>    >	addr = dot - ((vcline - 2) + (cnt-1)*basWLINES);

>    I'll have to take exception to this; the correctly modified line
>    should be:
>    
>    	addr = dot - vcline - 2 - (cnt-1)*basWLINES;

Wrongo; the first fix is correct.  In fact, there's another bug in the
following line, too.  The complete fix is:

		if (one + vcline != dot && vcnt > 2) {
	*		addr = dot - vcline + 2 - (cnt-1)*basWLINES;
	*		forbid (addr <= one);
			dot = addr;
			vcnt = vcline = 0;
		}

--
Scott Stevens
AT&T Consumer Products
Indianapolis, Indiana, USA
UUCP: inuxh!stevens
Re: 3 minor 'vi' bugs.
#232
Author: Jeff Gilliam
Date: Thu, 12 Jul 1984 06:51
32 lines
1574 bytes
>   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 ...
>
>	/* original code */
>	addr = dot - vcline - 2 + (cnt-1)*basWLINES;
>	/* modified code */
>	addr = dot - ((vcline - 2) + (cnt-1)*basWLINES);

I'll have to take exception to this; the correctly modified line
should be:

	addr = dot - vcline - 2 - (cnt-1)*basWLINES;

After making this change try the following to verify it really
works:

	vi somefile
	10^F			(move forward 10 screens full)
	10^B			(you should be right back at line 1)
	.
	.
	.

Regarding your second and third bugs: they're fixed in 4.2 (with
exactly the same code you suggest).

Jeff "No clever signature line yet" Gilliam
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads