Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.3 alpha 4/15/85; site elsie.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!panda!talcott!harvard!seismo!elsie!ado
From: ado@elsie.UUCP (Arthur David Olson)
Newsgroups: net.bugs.4bsd
Subject: vi, long lines, tabs, and terminals with insert (corrected reposting)
Message-ID: <5164@elsie.UUCP>
Date: Tue, 16-Jul-85 16:41:55 EDT
Article-I.D.: elsie.5164
Posted: Tue Jul 16 16:41:55 1985
Date-Received: Thu, 18-Jul-85 06:08:42 EDT
Organization: NIH-LEC, Bethesda, MD
Lines: 57

Index:		ucb/ex/ex_vput.c

Description:
	Insertions into long lines with tabs can get botched on terminals with
	insert mode.

Repeat-By:
	Get on a terminal that supports ANSI-style insert mode (a CIT-101e,
	for example).  Create a file with 79 'x' characters, a tab character,
	and a 'y' character.  Start up vi on the file; position the cursor on
	the tab; tap the 'i' key to go into insert mode; insert eight 'z'
	characters; ask yourself "Where did the 'y' go?"

Fix:
	The trade secret status of the code involved prevents a clearer posting.

	This is almost surely not the best fix.  It's to the function "vishft"
	in "ex_vput.c".  First, a previously reported change:

	.
	.
	.
#ifdef OLDVERSION
		for (j = DEPTH(vcline) - 1; j > (tabend + shft) / WCOLS; j--) {
#else
		for (j = DEPTH(vcline) - 1; j > (tabend+shft-1) / WCOLS; j--) {
#endif
	.
	.
	.

	And second, a "new" change:

	.
	.
	.
#ifdef OLDVERSION
		vigotoCL(tabstart);
		i = shft - (inssiz - doomed);
#else
		if ((tabstart / WCOLS) == (tabend / WCOLS)) {
			vigotoCL(tabstart);
			i = shft - (inssiz - doomed);
		} else {
			vigotoCL(tabend);
			i = shft;
		}
#endif
	.
	.
	.

--
Bugs is a Warner Brothers trademark.
--
	UUCP: ..decvax!seismo!elsie!ado    ARPA: elsie!ado@seismo.ARPA
	DEC, VAX and Elsie are Digital Equipment and Borden trademarks