[net.bugs.4bsd] vi, long lines, tabs, and terminals with insert

ado@elsie.UUCP (Arthur David Olson) (07/16/85)

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