From nobody@FreeBSD.org  Fri Nov 12 09:56:42 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C17361065696
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 12 Nov 2010 09:56:42 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id AE89B8FC0C
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 12 Nov 2010 09:56:42 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id oAC9ugU9056127
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 12 Nov 2010 09:56:42 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id oAC9ugSF056125;
	Fri, 12 Nov 2010 09:56:42 GMT
	(envelope-from nobody)
Message-Id: <201011120956.oAC9ugSF056125@www.freebsd.org>
Date: Fri, 12 Nov 2010 09:56:42 GMT
From: crocket <crockabiscuit@yahoo.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: On syscons, pressing delete key results in pressing backspace.
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         152162
>Category:       kern
>Synopsis:       [syscons] On syscons, pressing delete key results in pressing backspace.
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Nov 12 10:00:22 UTC 2010
>Closed-Date:    
>Last-Modified:  Sun Nov 21 15:40:09 UTC 2010
>Originator:     crocket
>Release:        8.1-RELEASE
>Organization:
>Environment:
FreeBSD elisa.muffinplace.com 8.1-RELEASE-p1 FreeBSD 8.1-RELEASE-p1 #2: Fri Nov 12 17:01:06 KST 2010     root@elisa.muffinplace.com:/usr/obj/usr/src/sys/ELISA  amd64
>Description:
For every keymap in /usr/share/syscons/keymaps,
none is capable of outputting \E[3~.

I investigated and concluded that syscons is not capable of outputting \E[3~.

Since \E[3~ is not available in syscons and keymaps,
delete key is forced to match ASCII DEL(^?), which is essentially the same as backspace in the majority of programs including /bin/sh, /bin/csh, and other shells. Therefore pressing delete key on syscons effects backspace.
Application settings can be configured to cooperate with syscons, but we have to configure so many applications just for one console driver, syscons.
As not everyone knows how to configure settings, some people would end up with delete key acting as backspace.
If syscons became capable of outputting \E[3~ for delete key, then delete key would just work on every application out of the box or without any configuration.

Thus, it's good to modify syscons so that it becomes capable of outputting \E[3~.
After modifying syscons, matching del key with \E[3~ in keymaps would finish the problem.

How does any of you think?
>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:

From: crocket <crockabiscuit@yahoo.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: misc/152162: On syscons, pressing delete key results in pressing backspace.
Date: Fri, 12 Nov 2010 07:26:02 -0800 (PST)

 I made us.iso.mod.kbd in /usr/share/syscons/keymaps and set both 083(Del key on the keypad) and 103(Delete key) to fkey65 and 014 to del(ASCII DEL) in us.iso.mod.kbd. I chose fkey65 because it's the first function key not used by default on FreeBSD.
 After that, I added keychanges="65 \E[3~" and keymap="us.iso.mod" in /etc/rc.conf and rebooted.
 With """JUST""" "bindkey \E[3~ delete-char" in /etc/csh.cshrc, csh deletes characters to the right in both syscons and X11 terminal emulators.
 In case of bash, you would add a similar setting.(I haven't tried bash)
 
 I think 014(backspace key on the keyboard) shouldn't match ASCII BS so that applications are free to use Ctrl-H(=ASCII BS).
 A detailed rationale for all of those above is elaborated in http://www.ibb.net/~anne/keyboard.html
 
 It's just a quick hack to match the keyboard behaviors in syscons and X11 terminal emulators so that delete key deletes a character to the right.
 So I want to see two things incorporated in the next release of FreeBSD(9.0-RELEASE?)
 1) fkey65 set to \E[3~ by default
 2) a new keymap based on us.iso.kbd or something similar that matches 083 and 103 to fkey65 and matches 014 to del.
 
 
       

From: Jilles Tjoelker <jilles@stack.nl>
To: bug-followup@FreeBSD.org, crockabiscuit@yahoo.com
Cc:  
Subject: Re: kern/152162: [syscons] On syscons, pressing delete key results
 in pressing backspace.
Date: Sun, 21 Nov 2010 16:32:13 +0100

 With the new "libteken" terminal emulator code in 9-current, syscons is
 now much like xterm. It appears that Backspace is still ^H, but Delete
 is now ^[[3~ instead of ^?.
 
 A while ago, I changed 9-current libedit (and therefore programs like sh
 and ftp) to recognize ^[[3~. I encourage you to ask tcsh upstream to fix
 this as well (either by hardcoding ^[[3~ somewhere or by using the
 appropriate termcap/terminfo field).
 
 Making the Backspace key send ^? may be slightly dangerous as it is
 rather annoying if Backspace does Delete (more annoying than Delete
 doing Backspace, IMHO). On the other hand, vte-based terminal programs
 such as gnome-terminal and xfce4's Terminal send ^? by default and it
 seems to work fine.
 
 -- 
 Jilles Tjoelker
>Unformatted:
