刪除鍵在終端機中不起作用

刪除鍵在終端機中不起作用

按下Delete終端機中的 鍵不會刪除轉送。它在編輯器和瀏覽器中工作,只有終端出現此問題。Ctrl+D仍然可以用作刪除鍵。

我已經按照另一篇文章運行了這些:

$ xmodmap -pke | grep -i delete
keycode  91 = KP_Delete KP_Decimal KP_Delete KP_Decimal
keycode 119 = Delete NoSymbol Delete
$ sudo dumpkeys | grep -i remove
keycode 111 = Remove
string Remove = "\033[3~"

我不確定這意味著什麼。

從這裡我可以去哪裡?

使用 Ubuntu 18.04.3 LTS 和預設終端

答案1

請遵循本常見問題解答中的詳細信息https://git.suckless.org/st/file/FAQ.html#l25我複製了 inputrccp /etc/inputrc ~/.inputrcset enable-keypad on在那裡取消註釋。

從連結中摘錄

  ## Why doesn't the Del key work in some programs?

  Taken from the terminfo manpage:

    If the terminal has a keypad that transmits codes when the keys
    are pressed, this information can be given. Note that it is not
    possible to handle terminals where the keypad only works in
    local (this applies, for example, to the unshifted HP 2621 keys).
    If the keypad can be set to transmit or not transmit, give these
    codes as smkx and rmkx. Otherwise the keypad is assumed to
    always transmit.

  In the st case smkx=E[?1hE= and rmkx=E[?1lE>, so it is mandatory that
  applications which want to test against keypad keys send these
  sequences.

  But buggy applications (like bash and irssi, for example) don't do this. A fast
  solution for them is to use the following command:

    $ printf '\033[?1h\033=' >/dev/tty

  or
    $ tput smkx

  In the case of bash, readline is used. Readline has a different note in its
  manpage about this issue:

    enable-keypad (Off)
        When set to On, readline will try to enable the
        application keypad when it is called. Some systems
        need this to enable arrow keys.

  Adding this option to your .inputrc will fix the keypad problem for all
  applications using readline.

相關內容