1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 05:12:40 +03:00

fix incorrect csi-u encoding with non-ascii characters

refs: https://github.com/wez/wezterm/issues/1746
This commit is contained in:
Wez Furlong 2022-03-21 20:37:26 -07:00
parent aba3da6a02
commit 5b09ff1dd0
2 changed files with 6 additions and 1 deletions

View File

@ -15,6 +15,7 @@ As features stabilize some brief notes about them will accumulate here.
#### Changed
#### Updated and Improved
#### Fixed
* Incorrect csi-u encoding with non-ascii characters. [#1746](https://github.com/wez/wezterm/issues/1746)
### 20220319-142410-0fcdea07

View File

@ -576,13 +576,17 @@ fn ctrl_mapping(c: char) -> Option<char> {
})
}
fn is_ascii(c: char) -> bool {
(c as u32) < 0x80
}
fn csi_u_encode(
buf: &mut String,
c: char,
mods: Modifiers,
encoding: KeyboardEncoding,
) -> Result<()> {
if encoding == KeyboardEncoding::CsiU {
if encoding == KeyboardEncoding::CsiU && is_ascii(c) {
write!(buf, "\x1b[{};{}u", c as u32, 1 + encode_modifiers(mods))?;
} else {
let c = if mods.contains(Modifiers::CTRL) && ctrl_mapping(c).is_some() {