[comp.sys.sun] cmdtool/c-shell filec clash

chuck@morgan.com (Chuck Ocheret) (03/31/89)

When I use csh I generally enable filename completion with "set filec."
This way, the escape key can be used to complete unambiguous filenames.
However, when this feature is used in a cmdtool the entire command line is
ignored.  This is probably due to the way cmdtool interprets the escape
key.  As a result I rarely use cmdtool.  Is there some way to either stop
cmdtool from choking on my escapes or to remap the file completion key
away from escape?

Thanks,
Chuck Ocheret

+------------------+   Chuck Ocheret, Sr. Staff Engineer
| chuck@morgan.com |       Morgan Stanley & Co., Inc.
|   Duty now ...   |19th Floor, 1251 Avenue of the Americas
+------------------+         New York, N.Y.  10020

guy@uunet.uu.net (Guy Harris) (04/25/89)

>When I use csh I generally enable filename completion with "set filec."
>This way, the escape key can be used to complete unambiguous filenames.
>However, when this feature is used in a cmdtool the entire command line is
>ignored.  This is probably due to the way cmdtool interprets the escape
>key.

No, it is due to a problem with the combination of:

	1) an editor ("textedit", basically, in this case) that takes
	   over the role of the canonical-mode tty processing
	   (erase/kill/etc.) and echoing (which is what happens in a
	   "cmdtool")

and

	2) a shell, such as the C shell with filename completion turned
	   on, that performs acts with the terminal driver best
	   described as "detestable and abominable crimes against
	   nature".

(For those of you who enjoy hearing about detestable and abominable
crimes, it basically attempts to push already-echoed input back into the
tty driver by turning echoing off and doing a bunch of TIOCSTI's.  The
problem is "what should the command subwindow code do in this situation?"
It probably needs to do something like mark the current line, take each
character TIOCSTIed as it arrives and replace characters of the current
line, starting at the beginning, with the TIOCSTIed characters, and when
echoing is turned back on blow away the characters on the rest of the
line.

Most of the time the character being replaced will be the same as the
character being TIOCSTIed, and there won't be any characters left on the
rest of the line, so it sounds offhand as if this *should* work.  However,
I wouldn't bet the rent money on it...  nor would I assume that these
changes are straightforward and that you can, once they're made, be
reasonably sure you haven't broken something else.

In order for this to work properly, a better mechanism needs to be
provided to notify the process on the master side of a pseudo-tty of
"ioctl"s on the slave side.  That's far from sufficient, however.)

>As a result I rarely use cmdtool.  Is there some way to either stop
>cmdtool from choking on my escapes or to remap the file completion key
>away from escape?

No.  Remapping the file completion key won't help - "the file completion
key", from the standpoint of the tty driver and/or "cmdtool", is just the
character that the C shell uses as the "secondary end-of-line" character,
and if you "remapped it away from escape" to some other character by
somehow convincing the C shell to use that other character as the
"secondary end-of-line character" (the C shell hardcodes escape, so you
can't do it anyway) the symptoms that escape used to exhibit would be
exhibited by that character instead.  It's not the particular character
code that's the problem....