[net.cog-eng] Cyber console command completion algorithm

decot@cwruecmp.UUCP (Dave Decot) (12/07/83)

See <232@denelcor>.

A problem with that algorithm is that one must constantly watch the screen
to see whether a command or parameter has been automatically completed or
not.  A better algorithm (I think) is the following:

	If the input character would cause the current word to be not
	one of the choices, do not echo the character, but ring the bell.

	If the input character causes the current word to become a prefix
	of a valid choice, echo and collect it.

	If the input character is a delimiter (space, tab, comma, newline),
	and a word is in progress, attempt to complete the word automatically.

	    If there is no unique completion, echo and collect as much as is
	    common to the alternatives, and ring the bell.

	    If there IS a unique completion, echo and collect it and the
	    delimiter.


So, for instance, to enter the command

	print report, abstract, references on printer 1

where the valid commands are PRINT, PROTECT, LIST, COLLATE, DELETE, and DO,
and the files available are REPORT, ABSTRACT, REFERENCES, ABACUS, and RANDOM,
and the devices are PRINTER 0, PRINTER 1, PLOTTER, SCREEN 0, and SCREEN 1,
and the only preposition allowed is ON,
any of the following inputs would echo as above and mean the same thing:

	pri rep,abs,ref o pr 1
	print rep,abs,ref on prin 1
	print report, abs, refer on pri 1

but anything ambiguous would ring the bell and refuse to echo.  Of course,
a ? facility (ala TOPS-20) would at any time list the options, and ESC
would attempt to complete the current word and give guide words.

Dave Decot
decvax!cwruecmp!decot    (Decot.Case@rand-relay)