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

term: fix representation of unmodified F5+

We were unconditionally adding the encoded form of the modifier
mask (eg: appending `;1~` to the sequence) and not all apps know
how to interpret that.

refs: https://github.com/wez/wezterm/issues/227
This commit is contained in:
Wez Furlong 2020-06-20 12:05:52 -07:00
parent fded650ccb
commit 59ca0da7ad
2 changed files with 10 additions and 1 deletions

View File

@ -39,6 +39,8 @@ brief notes about them may accumulate here.
* Improved terminal emulation conformance; added left/right margin support
and now passes [esctest](https://gitlab.freedesktop.org/terminal-wg/esctest)
to a similar degree as iTerm2
* Fixed an issue where unmodified F5+ would use the CSI-u encoded-modifiers
format, and confused eg: `htop`.
### 20200607-144723-74889cd4

View File

@ -905,7 +905,14 @@ impl TerminalState {
12 => "\x1b[24",
_ => bail!("unhandled fkey number {}", n),
};
write!(buf, "{};{}~", intro, 1 + encode_modifiers(mods))?;
let encoded_mods = encode_modifiers(mods);
if encoded_mods == 0 {
// If no modifiers are held, don't send the modifier
// sequence, as the modifier encoding is a CSI-u extension.
write!(buf, "{}~", intro)?;
} else {
write!(buf, "{};{}~", intro, 1 + encoded_mods)?;
}
buf.as_str()
}
}