At Wed, 24 Nov 2021 08:08:39 -0500, Greg Troxel <gdt%lexort.com@localhost> wrote: Subject: Re: wsvt25 backspace key should match terminfo definition > > The underlying issue is that the norms of some systems are to map that > "user wants to delete left easily reachable key" to BS and some want to > map it to DEL. I see these as the PC tradition and the UNIX tradition. I've just sent a long "history lesson" of a sort about this, but I'll try to distill it to what currently matters. I think describing it that way is, in part, what leads to some of the confusion surrounding this issue, especially for a system like NetBSD where for some scenarios the "system" is in full control over both sides of the problem. The real issue is quite simple -- users want to be able to use the easily reachable key that should delete the previously typed character to actually delete the previously typed character. That's it -- that's all there is to it. In the good old days this meant finding out what that key sent to the terminal would send when that key was pressed and using "stty erase" to set it properly (possibly also changing "stty intr" at the same time if that then conflicted). Sometimes this had to be done by the user, but ideally it would be the system manager who configured the correct defaults, especially for the "console" and any hard-wired terminals. Today in NetBSD we can also easily modify what the pressed key sends. (E.g. with wsconsctl(8) or with xmodmap(1), depending on one's environ) However there's also the issue of terminal type "descriptions", these days in the form of terminfo(5) (/usr/share/misc/terminfo) on NetBSD, and of course users can set up their own terminal descriptions. However it seems very difficult for many people to grasp what's really going with the interactions between all of these things and how to get the right behaviour, so unless you really do know how _ALL_ of the parts fit together, right from your keyboard to all of the applications you use, I would advise doing it the old fashioned way, and this should work no matter what kind of modern Unix or Unix-like system you are using, or what kind of terminal or console you are interacting with it through: 1. start the 'cat' program with no parameters: cat N.B.: This step and the next are critical -- you cannot trust anything that happens directly at a shell prompt to reveal what is really going on. 2. type a couple of words, but DO NOT press the return key asdf asdf 3. type the key you want to use to erase character by character 4. a) If it returns you to your shell prompt, continue to step 5a. b) If it erases the most previous character each time you press it, you're done -- press the return key, then <Control-D>. You should be back at the shell prompt and you don't need to do anything else. c) If two characters are echoed every time you press that key, for example "^H", then press the return key followed by <Control-D>, then continue to the next step (5): 5. Type "stty erase " followed by the two characters that were echoed, and then press the return key, e.g.: stty erase ^H Put a copy of this line in your ~/.profile followed by "tset -r" on the next line below, save your edits, logout and login and test that erase works correctly while running "cat". If not you will have to go back to step after restoring your ~/.profile to its previous state. If everything works OK, you're done. (You may, or may not, also want to change your interrupt key to DEL with a command like "stty intr ^?".) 5a. In this case your desired erase key is being recognized by the system as the interrupt key. You can examine the current settings with either "stty -a" or "stty -g". Most likely your interrupt key is set to be recognized as "^?". For example the third last line of the output from "stty -a" will include the phrase "intr = ^?;". In this case you can type the following command: stty intr ^C erase ^? Put a copy of this line in your ~/.profile, followed by "tset -r" on the next line below. save your edits, logout and login and test that erase works correctly while running "cat". If not you will have to go back to step after restoring your ~/.profile to its previous state. If everything works OK, you're done. If your interrupt key is not "^?" and you can't figure out what to do, then you need to ask for help. BTW, if you are using a real VT220 or compatible terminal then you can use "stty dec" to get the appropriate settings. This "should" work on the NetBSD console for i386 and amd64 and others using wscons(4). > So I think NetBSD should decide that we're following the UNIX tradition > that this key is DEL, You mean "the BSD tradition". See my previous reply. The Unix (or "UNIX") tradition is for "stty kill" to be 'DEL' (and erase to be either 'BS' or '#', depending on how far back you go). In my experience NetBSD already follows the BSD tradition very well. -- Greg A. Woods <gwoods%acm.org@localhost> Kelowna, BC +1 250 762-7675 RoboHack <woods%robohack.ca@localhost> Planix, Inc. <woods%planix.com@localhost> Avoncote Farms <woods%avoncote.ca@localhost>
Attachment:
pgpcmjWKj4xKt.pgp
Description: OpenPGP Digital Signature