From owner-freebsd-questions@freebsd.org Tue Dec 29 22:26:26 2015 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D7C4A5302F for ; Tue, 29 Dec 2015 22:26:26 +0000 (UTC) (envelope-from lists@bertram-scharpf.de) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.187]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mout.kundenserver.de", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E82771EED for ; Tue, 29 Dec 2015 22:26:25 +0000 (UTC) (envelope-from lists@bertram-scharpf.de) Received: from becker.bs.l ([85.180.11.241]) by mrelayeu.kundenserver.de (mreue003) with ESMTPSA (Nemesis) id 0LcTL8-1ZoN9V1GQY-00jtYC for ; Tue, 29 Dec 2015 23:26:23 +0100 Received: from bsch by becker.bs.l with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1aE2ik-0008rC-NI for freebsd-questions@freebsd.org; Tue, 29 Dec 2015 23:26:22 +0100 Date: Tue, 29 Dec 2015 23:26:22 +0100 From: Bertram Scharpf To: freebsd-questions@freebsd.org Subject: Re: delete button in console Message-ID: <20151229222622.GA18290@becker.bs.l> Mail-Followup-To: freebsd-questions@freebsd.org References: <56825701.30908@gmail.com> <20151229180750.187ed7c9.freebsd@edvax.de> <5682F182.7080603@hiwaay.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <5682F182.7080603@hiwaay.net> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: Bertram Scharpf X-Provags-ID: V03:K0:dfPTZbx801GstJBxDczo3jPd32r8LESuZljU1rlk1TnHli9qDdO nn9HYi1s4UaKKGd+x6G1PDNUk3qyh+1GVMeUZzg7tb6Encd8Ei7gR9KlhMVaUrWTl4UcscB zVXRudWvUqVL72iMfZuRRbZuNbNVc3jQQCk9M4MhE+LyPL5EektjIhUYa5lBrS3Z1QJC1F6 YGp0rWIvzxKRbExweA3jw== X-UI-Out-Filterresults: notjunk:1;V01:K0:owuInvnralI=:EapLg/LUhtOxI3qLg/X7/B DeNaL6qFykoehiAEnAT5ck/jPpQlGbM0c5OOTkANRMFCwAhhz0QQ3r6XNFkOaUQdUADS+UIi/ 9Tb13CB7JWWHXfSZHgoSvuE0gXdikrnfHFgbWlFoF707rlv+kklVfto9cmEsj4hB1wvRkArxL 4gpgekFRJ9KgU/MFqfdafD4n6qbRgXi5dvyZwjbqXsYNvHKtcR66qnrSvroqoM9LOzs2uqALN Fptm2VJBiTxdP1YS5EjVXs+ygwCI56g90oMN5GD5st5pOGGLpNapY6/nvAsZ3DcKYHPzY57Ng UYp8/0eU2FUDlEhyFfcVqq2EH4HJFFp6yZanMpz9ldtmOODqJ09vQfqngLEWw+n53t97d/XeS 7zEt99wTPgYJuu9tjDsGVM8YozjVOmD01e28nlz0OAhe50bEhoCYAiAiUwMEN4lwz24cl8t+y KqZdPdTcnPsUVK4tx5oOpGmOoShu5+5A4MdIN14yRTQYkva93m8hL5nNuBJmQuPtXgDtLXGnH 91a53mMd4atOAIz9aftYR3sTjFQ7dpjIf6nLZnqzjkd2eFVYBuf61yk/wAYwpkdCH0IFBVG/X NUCT8NrEO2eBMPxOpOl4fMp5kLH+zy68rljqCP2lnhRP5lLqhND3her9wzoRY/dgOKl2t3+G1 LcWfw87UXX2SBjrcXsZPtJ3nG5q77b9kjDUoTymcZU3jz4fyzX6WL+1u/J6mf0Y7T4CQ= X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Dec 2015 22:26:26 -0000 Hi, On Tuesday, 29. Dec 2015, 14:53:32 -0553, William A. Mahaffey III wrote: > On 12/29/15 11:14, Polytropon wrote: > > On Tue, 29 Dec 2015 01:48:49 -0800, Sergei G wrote: > >> When I ssh to a FreeBSD machine and press 'Delete' button in csh prompt > >> I get character '~' printed on screen. Backspace works just fine. > >> > >> I think even an actual console behaves the same way. > >> > >> Is there a way to "map" the Delete button to work appropriately? Would > >> it be my SSH client application or FreeBSD itself? > > This is a thing that can be configured for the shell. I assume > > you're using FreeBSD's default dialog shell, the C shell. In > > this case, add to ~/.cshrc: > > > > bindkey ^? delete-char # for console > > bindkey ^[[3~ delete-char # for xterm > > > > Or to /etc/csh.cshrc, if you want to make it a global setting. > > > > You can check the success with the "stty -a" command. > > Is this keyboard dependent ? My keyboard apparently sends '^?' for its > backspace key. When I try the above, then 'stty -a', I see no setting. I cannot see what stty should have to do with it. stty's "erase" and "erase2" do only work when icanon is set. Unfortunately "stty -a" yields wrong results because the shell changes the parameters before entering the "stty" program. To determine the true values, do the following. $ tty /dev/pts/5 Here, 5 could be any number depending on what was allocated when the emulator window was started. Then open another terminal and ask there: $ stty -a -f /dev/pts/5 Of course, replace the 5 by the right number. You will see a "-icanon". Notice the minus in front of the property. That means every key pressed will be passed to the command line editor immediately. If icanon is on, the line must be completed by pressing enter or return (^M) and after that the characters will be passed to the input-processing program. In this mode the backspace (^H) deletes characters and the input routine will not be aware they were pressed at all. "delete-char" is a csh function (man csh). Probably there is something like delete-char-to-left that will be executed on backspace (^H). I did not find it. In Zsh its name is "backward-delete-char". By the way, you can explore the escape codes produced by arrow keys etc. using the dd program. Just say $ dd and play around with the Ins/Del/Home/End/Fx etc. keys. As long as dd runs, icanon is set. Convince yourself of that by executing the above stty command again. Leave dd by pressing Ctrl-C. Bertram -- Bertram Scharpf Stuttgart, Deutschland/Germany http://www.bertram-scharpf.de