Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Emits of Additional ANSI Characters #4991

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion window/src/os/x11/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,13 @@ impl KeyboardWithFallback {
}
_ => sym,
}
} else if kc.is_none() && key_code_from_sym.is_none() {
} else if kc.is_none()
&& key_code_from_sym.is_none()
// Make sure that non-standard modifier keys of Neo2 layout are not mapped
// to a fallback because that would result in extra emitions of the
// original ANSI characters
&& !Self::is_keysym_iso_modifier(xsym)
{
// Not sure if this is a good idea, see
// <https://github.com/wez/wezterm/issues/4910> for context.
match fallback_feed {
Expand Down Expand Up @@ -457,6 +463,19 @@ impl KeyboardWithFallback {
}
}

fn is_keysym_iso_modifier(xsym: xkbcommon::xkb::Keysym) -> bool {
use xkbcommon::xkb::Keysym;
matches!(
xsym,
Keysym::ISO_Level3_Lock
| Keysym::ISO_Level3_Shift
| Keysym::ISO_Level5_Lock
| Keysym::ISO_Level5_Shift
| Keysym::ISO_Level3_Latch
| Keysym::ISO_Level5_Latch
)
}

fn mod_is_active(&self, modifier: &str) -> bool {
// [TODO] consider state Depressed & consumed mods
self.selected
Expand Down