microsoft/Terminal

Terminal should support libtickit style input

Open

#8,719 建立於 2021年1月7日

在 GitHub 查看
 (7 留言) (8 反應) (0 負責人)C++ (3,212 fork)batch import
Area-InputHelp WantedIssue-TaskProduct-Conpty

倉庫指標

Star
 (35,764 star)
PR 合併指標
 (平均合併 27天 19小時) (30 天內合併 24 個 PR)

描述

Environment

Windows build number: 10.0.19042.0
Windows Terminal version (if applicable): 1.4.3243.0
WSL: ubuntu 20.04, with bash 5.0.17

Steps to reproduce

Open a new tab with a shell from ubuntu 20.04, run showkey -a, then hit backspace, then shift+backspace etc, WT sends:

  • 0x7f for backspace
  • 0x08 for ctrl+backspace
  • 0x7f for shift+backspace
  • 0x7f for ctrl+shift+backspace

(hit ctrl+d to end the showkey -a session)

Expected behavior

Expecting to be able to distinguish modifier + backspace key presses.

I like to make it so that ctrl+backspace deletes previous word, and ctrl+shift+backspace deletes everything preceding the cursor. I do so via ~/.inputrc, which works on most VT terminals:

"\e[127;5u": backward-kill-word     # ctrl+backspace
"\e[127;6u": backward-kill-line     # ctrl+shift+backspace
"\e[3;5~": kill-word                # ctrl+delete
"\e[3;6~": kill-line                # ctrl+shift+delete

I was able to make it work easily by adding this to my settings.json in WT:

{ "command": {"action": "sendInput", "input": "\u001b[127;2u" }, "keys": "shift+backspace" },
{ "command": {"action": "sendInput", "input": "\u001b[127;5u" }, "keys": "ctrl+backspace" },
{ "command": {"action": "sendInput", "input": "\u001b[127;6u" }, "keys": "ctrl+shift+backspace" },

Actual behavior

WT does not seem to distinguish modifier + backspace key presses (at least not in WSL).

貢獻者指南