mirror of
https://github.com/wez/wezterm.git
synced 2024-09-19 18:57:59 +03:00
xkeyboard: resolve ambiguous CTRL-i / CTRL-Tab
We want to avoid normalizing control key presses; there were two places where it was happening; one in our own code and the other was in the xkeyboard mapping stuff itself. refs: https://github.com/wez/wezterm/issues/1851
This commit is contained in:
parent
88601f6841
commit
fdb3471017
@ -17,6 +17,7 @@ As features stabilize some brief notes about them will accumulate here.
|
|||||||
* Flush after replying to XTGETTCAP. [#1850](https://github.com/wez/wezterm/issues/1850)
|
* Flush after replying to XTGETTCAP. [#1850](https://github.com/wez/wezterm/issues/1850)
|
||||||
* macOS: CMD-. was treated as CTRL-ESC [#1867](https://github.com/wez/wezterm/issues/1867)
|
* macOS: CMD-. was treated as CTRL-ESC [#1867](https://github.com/wez/wezterm/issues/1867)
|
||||||
* `nf-mdi-contacts` nerdfont symbol treated as zero-width [#1864](https://github.com/wez/wezterm/issues/1864)
|
* `nf-mdi-contacts` nerdfont symbol treated as zero-width [#1864](https://github.com/wez/wezterm/issues/1864)
|
||||||
|
* X11/Wayland: CTRL-i, CTRL-j, CTRL-m misinterpreted as CTRL-Tab, CTRL-Enter, CTRL-Return [#1851](https://github.com/wez/wezterm/issues/1851)
|
||||||
|
|
||||||
### 20220408-101518-b908e2dd
|
### 20220408-101518-b908e2dd
|
||||||
|
|
||||||
|
@ -1041,7 +1041,7 @@ fn normalize_shift(key: KeyCode, modifiers: Modifiers) -> (KeyCode, Modifiers) {
|
|||||||
fn normalize_ctrl(key: KeyCode, modifiers: Modifiers) -> (KeyCode, Modifiers) {
|
fn normalize_ctrl(key: KeyCode, modifiers: Modifiers) -> (KeyCode, Modifiers) {
|
||||||
if modifiers.contains(Modifiers::CTRL) {
|
if modifiers.contains(Modifiers::CTRL) {
|
||||||
if let KeyCode::Char(c) = key {
|
if let KeyCode::Char(c) = key {
|
||||||
if c != '\t' && (c as u32) < 0x20 {
|
if (c as u32) < 0x20 {
|
||||||
let de_ctrl = ((c as u8) | 0x40) as char;
|
let de_ctrl = ((c as u8) | 0x40) as char;
|
||||||
return (KeyCode::Char(de_ctrl.to_ascii_lowercase()), modifiers);
|
return (KeyCode::Char(de_ctrl.to_ascii_lowercase()), modifiers);
|
||||||
}
|
}
|
||||||
|
@ -107,8 +107,18 @@ impl Compose {
|
|||||||
}
|
}
|
||||||
ComposeStatus::Nothing => {
|
ComposeStatus::Nothing => {
|
||||||
let utf8 = key_state.borrow().key_get_utf8(xcode);
|
let utf8 = key_state.borrow().key_get_utf8(xcode);
|
||||||
|
// CTRL-<ALPHA> is helpfully encoded in the form that we would
|
||||||
|
// send to the terminal, however, we do want the chance to
|
||||||
|
// distinguish between eg: CTRL-i and Tab, so if we ended up
|
||||||
|
// with a control code representation from the xkeyboard layer,
|
||||||
|
// discard it.
|
||||||
|
// <https://github.com/wez/wezterm/issues/1851>
|
||||||
|
if utf8.len() == 1 && utf8.as_bytes()[0] < 0x20 {
|
||||||
|
FeedResult::Nothing(String::new(), xsym)
|
||||||
|
} else {
|
||||||
FeedResult::Nothing(utf8, xsym)
|
FeedResult::Nothing(utf8, xsym)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ComposeStatus::Cancelled => {
|
ComposeStatus::Cancelled => {
|
||||||
self.state.reset();
|
self.state.reset();
|
||||||
FeedResult::Cancelled
|
FeedResult::Cancelled
|
||||||
@ -375,7 +385,6 @@ impl Keyboard {
|
|||||||
key_is_down: pressed,
|
key_is_down: pressed,
|
||||||
raw: Some(raw_key_event),
|
raw: Some(raw_key_event),
|
||||||
}
|
}
|
||||||
.normalize_ctrl()
|
|
||||||
.normalize_shift();
|
.normalize_shift();
|
||||||
|
|
||||||
if pressed && want_repeat {
|
if pressed && want_repeat {
|
||||||
|
Loading…
Reference in New Issue
Block a user