NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: That DEL key thing...



pl%szwajn.net@localhost (pl) writes:

>so my built-in keyboard is a PS/2 one, it seems.
>I added that line to wscons.conf (and yes, wscons is enabled by default there), now backspa^W backarrow generates "^H", DEL "^?". However both still erase to the left


There is only a "erase to the left" function and that is what the
"erase" character does.

Anything else is behaviour of the specific program, which take over
input processing (by switching to cbreak or raw mode of the tty):

bash or tcsh (i.e. same as the editline library) will just
treat both the same unless configured.

E.g. for tcsh you can use the command:

bindkey "^?" delete-char

The equivalent for the editline library is an entry in ~/.editrc:

bind ^? ed-delete-next-char

Our /bin/sh does use editline.

bash knows the command:

bind "Del:delete-char"

and the GNU readline library reads ~/.inputrc:

"\177" delete-char


>> DEL has never removed characters to the right in my experience.
>> However the Keypad Delete to the right is usually configured that way.

That depends...

bash-5.2$ bind -p|grep delete-char
"\C-h": backward-delete-char
"\C-?": backward-delete-char
"\C-d": delete-char
"\e[3~": delete-char
# delete-char-or-list (not bound)
# forward-backward-delete-char (not bound)

The \e[3~ is what the "Keypad Delete" key will produce; which is the
same as the regular "Delete" key on a USB keymap. And "\C-d" (Ctrl+d)
is the documented default key binding for the same operation.


>I come from Windows, Linux background where BS removed from left and DEL erased to the right. FreeBSD behaves similiarly - Well, it also works that way on X11 on NetBSD. Meanwhile on wscons both remove to the left

That is completely independent of the environment. It's a function of
the particular program you run (e.g. the shell).

For a simple comparison you could issue the command 'cat' (that just
reads input and writes what it read to output, finish with ctrl-d).

The cat program has no idea about things like keyboard or line-editing,
but gets what the terminal driver supports (what the stty command
shows), and there is no line-editing either, just backspace/rubout.



>My EeePC lacks keypad. External USB keyboard generates "^[[3~" on keypad DEL which seems to have no effect in wscons (writes a tilde), in X11 it's same as the DEL key.

I am quite sure that "in X11" it also writes a tilde. E.g.
hitting the Delete key thrice followed by a return:

% ~~~~
~~~: Command not found.
% cat
^[[3~^[[3~^[[3~

%

That's tcsh in an xterm. tcsh mostly ignores the characters, only
the ~ qualifies as input. But when running 'cat', the tty driver
handles input (and it doesn't know things like line-editing either)
and there you get echoed the complete sequence.

Now... when you enable the 'Delete is DEL' function in xterm, then:

% 
% cat
^?^?^?

% 


But doing the same with the Delete key on the numeric keypad is still:

% ~~~~
~~~~: Command not found.
% cat
^[[3~^[[3~^[[3~

% 




Greetings,


Home | Main Index | Thread Index | Old Index