Re: Arrow keys in informix generally
Posted in 1991
Tony Heskett wrote: [Lots of good stuff deleted] > > The real problem is that whatever interpreter you're running - > vi, or a 4gl executable, or Uniplex, for example - has to accept > commands and act on them. > > Function keys transmit *more than 1 char* and the meaning of the > group of characters actually sent is mapped to a token (e.g. > F1) by curses, or equiv., using the termcap or terminfo > libraries. The application knows what to do for that token. > > Where commands are normal words, they are easily > distinguished/delimited by whitespace (as in, "SELECT * FROM > foo") and there is no problem even where some commands contain > others as substrings (as in, FOR and FOREACH). > > Where function keys are used as commands, curses can only guess > where commands start and finish by looking for gaps in the flow > of input characters and, as Richard says, this is often > unsatisfactory over a network. > > Note that the actual characters are unimportant: if my F1 key > returns ^AA and my F2 key returns ^AAB, the F2 key can still > appear to be F1 followed by the letter B. The problem is when you have two function keys, say F1 and F2, and one of them transmits a character sequence **which is a prefix of the other's character sequence**. Clearly this can only happen when one or both of them sends a multi-character sequence; however, using multi-character sequences does not have to involve this problem. This doesn't depend on the exact characters involved -- all the below would have problems in recognising F2 correctly: F1 F2 <ESC> <ESC>AB <ESC> <ESC>AB <ESC>A <ESC>AB ^AA ^AAB However, one fairly clean work-around to all this is simply to ensure that you don't have any keys where one is a prefix of another. This may be hard where people are expecting to use the ESC key, but it is worth doing, either by changing the characters sent by the ESC key while the application is in use, or by using another key for ACCEPT. This problem originally surfaced in vi, and Informix appears to have copied this without looking at the implications. It causes all kinds of problems, especially with people learning UNIX who are used to using the cursor keys to navigate around a file. There *are* editors, such as GNU Emacs, where you can press function keys, on auto repeat and/or over a network, without a single failure to recognise the function key, even though multi-char sequences are used. It's all a matter of choosing the right function key mappings. As often happens, UNIX is being placed into situations where its design decisions are beginning to creak a bit. Hopefully these issues will be fixed over time. And when the world goes to graphical user interfaces all this will be irrelevant :-) > > If you want your users to be able to press the ESC key, and you have > > a customisable keyboard (e.g. via a PC terminal emulator), you can > > re-program the ESC key to send a distinct Escape sequence that is > > not used by any other keys, which will provide the users with the > > same interface but remove the problem. > > It may not apply in your user environment, but I'd just hate this ! > Like pressing the "A" key and getting "Q" back ! It'll also > tend to louse up other applications. This should be invisible to the user in your application -- they press a key marked ESC, it sends a multi-char sequence, and the action they expect is taken by the application. It would mess up other apps, but it may be possible to initialise the terminal to change ESC on app startup, then change ESC back on app exit; it would be worth doing this in a shell script wrapper that catches interrupts etc, so that even if your application crashes the terminal is reset. > -- > Cheers - Tony. > > ********************* LAST FEW DAYS AT THIS ADDRESS ************************ > Tony Heskett: theskett@lhr-sys.ssf-sys.dhl.com | Vox: (+44) 81 747 8330 > DHL Systems : Kings House, Great West Road, TW8 9HS | Fax: (+44) 81 747 0875 > Richard =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Richard Donkin Hoskyns Open Systems Division Internet: richardd@inset.co.uk 190 City Road, LONDON EC1V 2QH UUCP: ...!mcsun!ukc!inset!richardd United Kingdom Fax: +44 71 251 2853 Tel: +44 71 251 2128