# The "Canc" key on my italian keyboard doesn't behave well on FreeBSD.



## ziomario (Aug 2, 2021)

Hello to everyone.

The "Canc" key on my Italian keyboard doesn't behave like it behaves in Linux. I would like to know how to fix it. Below u can see what happens when I press "Canc" on Debian and on FreeBSD.

"Canc" behavior on Debian : https://drive.google.com/file/d/1F-kPpkKENFXooXagkVeK3kuQn9tf1Rbg/view?usp=sharing

"Canc" behavior on Freebsd : https://drive.google.com/file/d/1ZJF1GJNrpdTmEBVwkcsXNfErRTQlfG7X/view?usp=sharing

very thanks.


----------



## eternal_noob (Aug 2, 2021)

See 4.4.4. How do I use my delete key in sh and csh?


----------



## ziomario (Aug 2, 2021)

I'm using csh and "xfce4-terminal" :

root@marietto:~ # echo "$SHELL"
/bin/csh

and I've added bindkey ^[[3~ delete-char to ~/.cshrc ; but I didn't fix the problem. Now I don't have the tilde anymore,but pressing "canc" I don't have the same effect that I have using it on Linux. The "FreeBSD Documentation Project" tells that it is valid for xterm ; isn't xfce4-terminal like xterm ? how to fix ?


----------



## SirDice (Aug 2, 2021)

In an xterm, press ctrl-v then hit the "Canc" (Del?) button. See if it's the correct escape code.


----------



## ziomario (Aug 2, 2021)

when I press ctrl-v on xterm I see ^V and when I press Canc/Del,I don't see anything on the screen. That key don't work at all.


----------



## SirDice (Aug 2, 2021)

ziomario said:


> when I press ctrl-v on xterm I see ^V


Don't press ctrl-v twice.


----------



## ziomario (Aug 2, 2021)

ok. pressing it one time only,I don't see any character printed on the screen.


----------



## SirDice (Aug 2, 2021)

Does x11/xev show that the key is active? Maybe you selected a keyboard layout that disabled the key.


----------



## ziomario (Aug 2, 2021)

when I press Canc I see :

```
KeyPress event, serial 37, synthetic NO, window 0x4600001,
    root 0x765, subw 0x0, time 5083868, (97,310), root:(968,755),
    state 0x0, keycode 119 (keysym 0xffff, Delete), same_screen YES,
    XLookupString gives 1 bytes: (7f) ""
    XmbLookupString gives 1 bytes: (7f) ""
    XFilterEvent returns: False
```


----------



## ziomario (Aug 2, 2021)

when I press "CTRL V" :

```
KeyRelease event, serial 37, synthetic NO, window 0x4600001,
    root 0x765, subw 0x0, time 5171449, (414,290), root:(1285,735),
    state 0x4, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False
```


----------



## SirDice (Aug 2, 2021)

Ctrl-v is a special key combination, it allows you to view the next key "verbatim", in other words you can see the key's escape code or keycode.


```
state 0x0, keycode 119 (keysym 0xffff, Delete), same_screen YES,
```
That shows it at least registers as a "Delete" key, which is good.


----------



## Tieks (Aug 2, 2021)

ziomario said:
			
		

> isn't xfce4-terminal like xterm ? how to fix ?



I can confirm that xfce4-terminal shows the same behaviour. With default settings pressing Delete (= Canc) inserts a tilde. You can make it behave like the Backspace key choosing 'ASCII DEL' under Preferences, Compatibility.
Being non-Italian and using csh I included `bindkey "\e[3~" delete-char` in ~/.cshrc with default settings in xfce4-terminal. Both Backspace and Delete work as expected now.


----------



## ziomario (Aug 2, 2021)

adding "bindkey "\e[3~" delete-char in ~/.cshrc worked,but it didn't choosing 'ASCII DEL' under Preferences, Compatibility.


----------



## Erichans (Aug 2, 2021)

Either one of the following two lines in your ~/.cshrc should have the same result:

```
bindkey "^[[3~" delete-char
bindkey "\e[3~" delete-char
```
The character sequence `^[` and the character sequence `\e` both represent the `ESC` character.
NOTE: `^[` is the caret-character followed by the character `[`



ziomario said:


> [...]  I've added bindkey ^[[3~ delete-char to ~/.cshrc ; but I didn't fix the problem.



Question: Did you add this line to your  ~/.cshrc  exactly as shown and by typing a caret-character? :

```
bindkey "^[[3" delete-char
```


----------



## ziomario (Aug 2, 2021)

It worked for some time using bindkey "\e[3~" delete-char and then,suddenly it stopped working ; now I'm using bindkey "\e[3" delete-char and it seems to work great. But I don't know until when.


----------



## SirDice (Aug 2, 2021)

XFCE Terminal has it's own settings with regards to the 'Del' key. Some terminals have those features. Gnome Terminal for example has its own settings too. PuTTY (if you use that) also has some settings you can change. This mostly stems from the fact that the 'Del' key isn't exactly standardized (well, the problem is that there are different standards). Same for the backspace key. On some systems it's ^H on others it's ^?.


----------



## ziomario (Aug 2, 2021)

SirDice said:


> XFCE Terminal has it's own settings with regards to the 'Del' key. Some terminals have those features. Gnome Terminal for example has its own settings too.



I know,but as I said,the settings that u see on the picture don't work. Instead,it seems to work adding the setting bindkey "\e[3" delete-char inside the file ~/.cshrc


----------



## SirDice (Aug 2, 2021)

ziomario said:


> Instead,it seems to work adding the setting bindkey "\e[3" delete-char inside the file ~/.cshrc


Yes, you're going to need that too. I use a few definitions for 'Home' and 'End' too:

```
bindkey "^[[1~" beginning-of-line # Home
                bindkey "^[[4~" end-of-line       # End
                bindkey "^[[3~" delete-char       # Del
```
Although I rarely use those keys, I've gotten accustomed to ctrl-a (beginning of the line) and ctrl-e (end of line).


----------



## ziomario (Aug 2, 2021)

So, should I add these both lines? (I'm not interested to bind Home and End too)

```
bindkey "\e[3~" delete-char
bindkey "\e[3" delete-char
```


----------



## SirDice (Aug 2, 2021)

Only the first one is valid. The entire escape code is `<ESC>[3~`. Yes, that ~ is part of it.


----------

