OpenBSD-4.6/usr.bin/vi/docs/TODO

CL:	In single-line screens, have to press 'q' twice when quitting out
	of  a ":set all" display.

COMMON:	There's a serious problem with error returns -- we need to separate
	command failure from fatal error, consistently, over the entire source
	tree.

	We need to rework all of vi to have three return values:

	0: success
	1: vi error, continue
	2: fatal error, die

	Right now we don't recognize fatal errors for what they are.

VI:	Change the screen scrolling to not eat user characters...  i.e.
	g/pattern/foo should not eat already entered chars.

COMMON:	It's known that it's possible to sync the backing files in the
	wrong manner, leaving backup files that aren't recoverable.  This
	is going to be left alone until we have a logging version of DB,
	which will hopefully fix this (or at least make it possible to
	easily do so).

COMMON:	The complete list of POSIX.1 calls that can return EINTR are:

	wait, waitpid, sleep, dup2, close, read, write,
	fcntl(SETLCKW) tcsetattr, tcdrain

	The problem is that technically, any system/library call can
	return EINTR, so, while nvi blocks (most of?) the obvious ones,
	someone may have to do a complete pass and block signals
	everywhere.

COMMON: The vi main command loop should use the general-purpose overflow
	and underflow routines.  In addition, the vi command loop uses
	unsigned longs -- should probably be fixed as a 32-bit unsigned
	type, and then check to make sure it's never used as as variable
	type again.

DB:	When nvi edits files that don't have trailing newlines, it appends
	one, regardless.  This is required, by default, from POSIX.2.

COMMON:	Open mode is not yet implemented.

COMMON:	^C isn't passed to the shell in the script windows as an interrupt
	character.

COMMON:	The options:

	hardtabs, lisp, optimize, redraw, slowopen

	are recognized, but not implemented.  These options are unlikely
	to be implemented, so if you want them you might want to say
	something!  I will implement lisp if anyone ever documents how it
	worked.

COMMON:	If you run out of space in the recovery directory, the recovery
	file is left in place.

COMMON:	Should "view" set a lock on the file?

COMMON:	Field editing shouldn't be hard to add to nvi:

	Field editing file template:

	version #
	field #	row/column start	row/column stop
	label	field #		Label string
	re	field #		Matching re string.
	field #	row/column start	row/column stop
	label	field #		Label string
	re	field #		Matching re string.

	<tab> moves to the next field
	<bs> in column 0 moves to the previous field

COMMON:	Let's rethink using an IPC mechanism:

	Two way channel, with events passing in both directions.

	Load into the same address space (else, how do file permissions) forks
	in v_init -- screens get events from vi, vi gets events queued up from
	screens.

	  Vi:
		E_CHARACTER,            /* Input character: e_c set. */
		E_EOF,                  /* End of input (NOT ^D). */
		E_ERR,                  /* Input error. */
		E_INTERRUPT,            /* Interrupt. */
		E_REPAINT,              /* Repaint: e_flno, e_tlno set. */
		E_RESIZE,               /* SIGWINCH: e_lno, e_cno set. */
		E_SIGCONT,              /* SIGCONT arrived. */
		E_SIGFATAL,             /* fatal signal arrived.
		E_START,                /* Start ex/vi. */
		E_STOP,                 /* Stop ex/vi. */
		E_STRING,               /* Input string: e_csp, e_len set. */

	  Screen:
		E_ADDSTR		/* Add a string to the screen. */
		E_ATTRIBUTE		/* Screen attribute. */
		E_BELL			/* Beep/bell/flash the terminal. */
		E_BUSY			/* Display a busy message. */
		E_CANONICAL		/* Enter tty canonical mode. */
		E_CLRTOEOL		/* Clear to the end of the line. */
		E_CURSOR		/* Return the cursor location. */
		E_DELETELN		/* Delete a line. */
		E_DISCARD		/* Discard a screen. */
		E_EXADJUST		/* Ex: screen adjustment routine. */
		E_FMAP			/* Set a function key. */
		E_GETKEY		/* Get a key event. */
		E_INSERTLN		/* Insert a line. */
		E_MOVE			/* Move the cursor. */
		E_MESSAGE		/* Message or ex output. */
		E_REFRESH		/* Refresh the screen. */
		E_RESIZE		/* Resize two screens. */
		E_SPLIT			/* Split the screen. */
		E_SUSPEND		/* Suspend the editor. */

EX:	It would be nice to inverse video the replaced text during
	interactive substitute.

EX:	The :args command should put the current file name out in reverse
	video.  This isn't going to be easy, currently only full lines can
	be in reverse video, not just parts.

TK:	We currently permit the user to change the lines, columns and term
	edit options.  Shouldn't that be illegal in tknvi?

VI:	The strings found by searches should be highlighted until the next
	character is entered.

VI:	Display a split vi screen for the :help command.

VI:	When getting a key for a continue screen, we should always read from
	the terminal, not from a mapped key.

VI:	The sentence, paragraph and section movement commands don't match
	historic practice in some boundary cases.  This should be left
	alone until POSIX 1003.2 makes up its mind.

VI:	The vs_sm_fill routine should scroll if possible, not always redraw.

VI:	Think about setting a dirty/inuse bits on the lines of the SMAP
	structure.  That way the message routines could steal lines and
	refresh would continue to work, because it would know not to touch
	the lines that were in use.