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:
parent
aba3da6a02
commit
5b09ff1dd0
@ -15,6 +15,7 @@ As features stabilize some brief notes about them will accumulate here.
|
|||||||
#### Changed
|
#### Changed
|
||||||
#### Updated and Improved
|
#### Updated and Improved
|
||||||
#### Fixed
|
#### Fixed
|
||||||
|
* Incorrect csi-u encoding with non-ascii characters. [#1746](https://github.com/wez/wezterm/issues/1746)
|
||||||
|
|
||||||
### 20220319-142410-0fcdea07
|
### 20220319-142410-0fcdea07
|
||||||
|
|
||||||
|
@ -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(
|
fn csi_u_encode(
|
||||||
buf: &mut String,
|
buf: &mut String,
|
||||||
c: char,
|
c: char,
|
||||||
mods: Modifiers,
|
mods: Modifiers,
|
||||||
encoding: KeyboardEncoding,
|
encoding: KeyboardEncoding,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
if encoding == KeyboardEncoding::CsiU {
|
if encoding == KeyboardEncoding::CsiU && is_ascii(c) {
|
||||||
write!(buf, "\x1b[{};{}u", c as u32, 1 + encode_modifiers(mods))?;
|
write!(buf, "\x1b[{};{}u", c as u32, 1 + encode_modifiers(mods))?;
|
||||||
} else {
|
} else {
|
||||||
let c = if mods.contains(Modifiers::CTRL) && ctrl_mapping(c).is_some() {
|
let c = if mods.contains(Modifiers::CTRL) && ctrl_mapping(c).is_some() {
|
||||||
|
Loading…
Reference in New Issue
Block a user