1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-10 15:04:32 +03:00

config: add send_composed_key_when_alt_is_pressed option

On macos, allow sending eg: ALT-F as ALT-F rather than the composed
graphics character (ƒ) that is the default for that combination in
the macos IME.

This is controlled by a new config option which defaults to false
so that we have the expected terminal behavior by default.
This commit is contained in:
Wez Furlong 2019-11-05 22:20:54 -08:00
parent eb1bc7f736
commit 3b93442590
2 changed files with 18 additions and 2 deletions

View File

@ -124,6 +124,13 @@ pub struct Config {
#[serde(default)]
pub daemon_options: DaemonOptions,
/// If set to true, send the system specific composed key when
/// the ALT key is held down. If set to false (the default)
/// then send the key with the ALT modifier (this is typically
/// encoded as ESC followed by the key).
#[serde(default)]
pub send_composed_key_when_alt_is_pressed: bool,
}
#[derive(Debug, Deserialize, Clone)]
@ -607,6 +614,7 @@ impl Default for Config {
tls_servers: vec![],
tls_clients: vec![],
daemon_options: Default::default(),
send_composed_key_when_alt_is_pressed: false,
}
}
}

View File

@ -26,7 +26,7 @@ use termwiz::color::RgbColor;
pub struct TermWindow {
window: Option<Window>,
fonts: Rc<FontConfiguration>,
_config: Arc<Config>,
config: Arc<Config>,
dimensions: Dimensions,
mux_window_id: MuxWindowId,
render_metrics: RenderMetrics,
@ -296,6 +296,14 @@ impl WindowCallbacks for TermWindow {
self.perform_key_assignment(&tab, &assignment).ok();
return true;
}
if !self.config.send_composed_key_when_alt_is_pressed
&& modifiers.contains(::termwiz::input::Modifiers::ALT)
{
if tab.key_down(key, modifiers).is_ok() {
return true;
}
}
}
}
@ -422,7 +430,7 @@ impl TermWindow {
Box::new(Self {
window: None,
mux_window_id,
_config: Arc::clone(config),
config: Arc::clone(config),
fonts: Rc::clone(fontconfig),
render_metrics,
dimensions: Dimensions {