Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site birtch.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!ihnp4!qantel!hplabs!sdcrdcf!trwrb!scgvaxd!felix!birtch!oleg From: oleg@birtch.UUCP (Oleg Kiselev x258) Newsgroups: net.unix Subject: Re: help - escape key detection Message-ID: <139@birtch.UUCP> Date: Tue, 1-Oct-85 01:33:13 EDT Article-I.D.: birtch.139 Posted: Tue Oct 1 01:33:13 1985 Date-Received: Mon, 7-Oct-85 03:41:44 EDT References: <595@dicomed.UUCP> <65900004@trsvax> Organization: Birtcher, Santa Ana, Ca. Lines: 23 > This is the solution adopted by vi: When an escape is read, the alarm > clock is set to one second and then a read is issued for the next character. > If read returns before the alarm goes off, it is assumed that characters > could have been transmitted that quickly only if they were generated by the > keyboard as a function key was pressed; if the alarm goes off (interrupting > read), it is assumed that the characters were typed slowly by a human--that > is, the escape itself was actually pressed. > > [goes on to describe problems with this system; eg. fast typist or > a slow system could screw this scheme up.] > --------------------------------------------------------------------------- > > It gives a section of code which would simulate what vi does. > If you are really interested in this, you should get a copy of this book. > George Moore (gm@trsvax.UUCP) Oops! Don't lough, but it seems we wasted a few hours writing the same damned thing... Only we used sititimer(2) ( a 4.2 BSD call - lets you set intervals in useconds). But, seriously, there is a problem with that scheme as well -- some terminals perform HOME and some other functions on the CRT ONLY -- and don't send anything to the program... Example - HDS terminals. Or am I missing something?