fix incorrect csi-u encoding with non-ascii characters

refs: https://github.com/wez/wezterm/issues/1746
This commit is contained in:
Wez Furlong committed 2022-03-21 20:38:42 -07:00
1 parent aba3da6a02
commit 5b09ff1dd0
2 files changed
+6 -1

No files matched your search

+1
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
+5 -1
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() {