Allow typing space in workspace::SendKeystrokes (#8288)
Fixes #8222 Release Notes: - N/A
This commit is contained in:
parent
b0872b5b57
commit
3bc7cd66b7
3 changed files with 43 additions and 12 deletions
|
@ -108,6 +108,35 @@ impl Keystroke {
|
|||
ime_key,
|
||||
})
|
||||
}
|
||||
|
||||
/// Returns a new keystroke with the ime_key filled.
|
||||
/// This is used for dispatch_keystroke where we want users to
|
||||
/// be able to simulate typing "space", etc.
|
||||
pub fn with_simulated_ime(mut self) -> Self {
|
||||
if self.ime_key.is_none()
|
||||
&& !self.modifiers.command
|
||||
&& !self.modifiers.control
|
||||
&& !self.modifiers.function
|
||||
&& !self.modifiers.alt
|
||||
{
|
||||
self.ime_key = match self.key.as_str() {
|
||||
"space" => Some(" ".into()),
|
||||
"tab" => Some("\t".into()),
|
||||
"enter" => Some("\n".into()),
|
||||
"up" | "down" | "left" | "right" | "pageup" | "pagedown" | "home" | "end"
|
||||
| "delete" | "escape" | "backspace" | "f1" | "f2" | "f3" | "f4" | "f5" | "f6"
|
||||
| "f7" | "f8" | "f9" | "f10" | "f11" | "f12" => None,
|
||||
key => {
|
||||
if self.modifiers.shift {
|
||||
Some(key.to_uppercase())
|
||||
} else {
|
||||
Some(key.into())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for Keystroke {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue