mirror of
https://github.com/wez/wezterm.git
synced 2024-12-23 21:32:13 +03:00
wezterm: add DisableDefaultAssignment action
Similar to Nop but allows the key press to pass through to the underlying tab. Expand docs to clarify how these two actions work.
This commit is contained in:
parent
b0ffa65727
commit
d361b8a7c5
@ -415,16 +415,32 @@ return {
|
||||
}
|
||||
```
|
||||
|
||||
## Nop
|
||||
## DisableDefaultAssignment
|
||||
|
||||
Does nothing. This is useful to disable a default key assignment.
|
||||
Has no special meaning of its own; this action will undo the registration
|
||||
of a default assignment if that key/mouse/modifier combination is one of the
|
||||
default assignments and cause the key press to be propagated through
|
||||
to the tab for processing.
|
||||
|
||||
```lua
|
||||
local wezterm = require 'wezterm';
|
||||
|
||||
return {
|
||||
keys = {
|
||||
-- Turn off the default CMD-m Hide action
|
||||
-- Turn off the default CMD-m Hide action, allowing CMD-m to
|
||||
-- be potentially recognized and handled by the tab
|
||||
{key="m", mods="CMD", action="DisableDefaultAssignment"},
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Nop
|
||||
|
||||
Causes the key press to have no effect; it behaves as though those
|
||||
keys were not pressed.
|
||||
|
||||
```lua
|
||||
return {
|
||||
keys = {
|
||||
-- Turn off any side effects from pressing CMD-m
|
||||
{key="m", mods="CMD", action="Nop"},
|
||||
}
|
||||
}
|
||||
|
@ -1444,7 +1444,7 @@ impl TermWindow {
|
||||
}
|
||||
}
|
||||
CloseCurrentTab => self.close_current_tab(),
|
||||
Nop => {}
|
||||
Nop | DisableDefaultAssignment => {}
|
||||
ReloadConfiguration => crate::config::reload(),
|
||||
MoveTab(n) => self.move_tab(*n)?,
|
||||
MoveTabRelative(n) => self.move_tab_relative(*n)?,
|
||||
|
@ -24,7 +24,7 @@ pub enum MouseEventTrigger {
|
||||
|
||||
/// When spawning a tab, specify which domain should be used to
|
||||
/// host/spawn that tab.
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
|
||||
pub enum SpawnTabDomain {
|
||||
/// Use the default domain
|
||||
DefaultDomain,
|
||||
@ -42,7 +42,7 @@ impl Default for SpawnTabDomain {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
||||
#[derive(Default, Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
|
||||
pub struct SpawnCommand {
|
||||
/// Optional descriptive label
|
||||
pub label: Option<String>,
|
||||
@ -70,7 +70,7 @@ pub struct SpawnCommand {
|
||||
pub domain: SpawnTabDomain,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
|
||||
pub enum KeyAssignment {
|
||||
SpawnTab(SpawnTabDomain),
|
||||
SpawnWindow,
|
||||
@ -85,6 +85,7 @@ pub enum KeyAssignment {
|
||||
ActivateTab(usize),
|
||||
SendString(String),
|
||||
Nop,
|
||||
DisableDefaultAssignment,
|
||||
Hide,
|
||||
Show,
|
||||
CloseCurrentTab,
|
||||
@ -343,6 +344,9 @@ impl InputMap {
|
||||
);
|
||||
}
|
||||
|
||||
keys.retain(|_, v| *v != KeyAssignment::DisableDefaultAssignment);
|
||||
mouse.retain(|_, v| *v != KeyAssignment::DisableDefaultAssignment);
|
||||
|
||||
Self { keys, mouse }
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ fn schedule_next_paste(paste: &Arc<Mutex<Paste>>) {
|
||||
});
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
|
||||
pub enum Pattern {
|
||||
CaseSensitiveString(String),
|
||||
CaseInSensitiveString(String),
|
||||
|
Loading…
Reference in New Issue
Block a user