Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site pegasus.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!ihnp4!pegasus!hansen From: hansen@pegasus.UUCP (Tony L. Hansen) Newsgroups: net.unix,net.unix-wizards Subject: Re: curses Message-ID: <2403@pegasus.UUCP> Date: Fri, 28-Jun-85 10:52:20 EDT Article-I.D.: pegasus.2403 Posted: Fri Jun 28 10:52:20 1985 Date-Received: Sat, 29-Jun-85 03:18:15 EDT References: <427@mmintl.UUCP> <505@dicomed.UUCP> <571@umd5.UUCP> Reply-To: hansen@pegasus.UUCP (60545451-Tony L. Hansen;LZ 3B-315;6243) Organization: AT&T Information Systems, Lincroft NJ Lines: 52 Keywords: input virtualization, ins-del line Xref: watmath net.unix:4906 net.unix-wizards:13662 Summary: Newer curses DO support input virtualization In article <571@umd5.UUCP> zben@umd5.UUCP (Ben Cranston) writes: >I posted flames on the same point. Curses does not support input translation. The old versions of curses that come withh 4.X BSD did not support input translations. This feature is just one of the many features that were added by Mark Horton to his version of curses when he rewrote it. It is also one of the reasons that he rewrote it. His version is now a part of System Vr2. By saying "keypad(stdscr, TRUE);", all input through stdscr is scanned for escape sequences that match those input keys specified in the terminfo entry. When one is found, an integer is returned whose value is #define'd in. These tokens are named such things as KEY_LEFT and KEY_HOME. Pavel Curtis' public-domain version of Mark Horton's curses also will do this translation. I have no idea how well it works. >I would really >like to move in the direction of terminal capabilities database, but on input >there are some real sticky questions. > >For example, when you are in column one, what does a left arrow do? On many >terminals it does nothing, on many more it goes to column 80 of the previous >line, on some it goes to column 80 of the SAME line. What does an up arrow >do on line one? Unix finesses all these questions by refusing to echo the >character in these situations. On mainframes without smart echo, one does not >have that handy copout. Thus, in addition to the simple question of what code >does each key generate, these little quirks must all be represented in the >database. Define the action to be what you want it to be. As long as pressing the key only causes an escape sequence to be translated, and doesn't really move the cursor locally, you have no problems. If the cursor is only local, then you have no knowledge whatsoever that the cursor got moved. If a sequence is transmitted AND the cursor is moved, then you have a bad terminal. In many cases, terminals of the last two sorts have an escape sequence that will change the action of the function keys. This sequence should be sent out upon startup. In terminfo, such a sequence would be defined by smkx=\Exxx. >One additional example. On many terminals, when you do an insert-line >operation, the cursor is left wherever it was. But, on the Heathkit, the >cursor is returned to column one! If you REALLY want to see some brain- >damage, look at the insert mode on the Datamedia 2000/3000 line. Terminfo and termcap only define insert-line/delete-line when the cursor is in column one. Mark Horton's curses will only use those capabilities when the cursor is in column one. (You get what you pay for.) Tony Hansen hansen@pegasus.ATT.UUCP