mirror of https://github.com/helix-editor/helix
clippy
parent
bb62dad76f
commit
94b5e0c210
|
@ -338,23 +338,21 @@ impl std::str::FromStr for KeyEvent {
|
||||||
KeyCode::from_str(tokens.pop().ok_or_else(|| anyhow!("Missing key code"))?)
|
KeyCode::from_str(tokens.pop().ok_or_else(|| anyhow!("Missing key code"))?)
|
||||||
{
|
{
|
||||||
code
|
code
|
||||||
} else {
|
} else if s.ends_with('-') && tokens.last().is_some_and(|t| t.is_empty()) {
|
||||||
if s.ends_with('-') && tokens.last().is_some_and(|t| t.is_empty()) {
|
if s == "-" {
|
||||||
if s == "-" {
|
return Ok(KeyEvent {
|
||||||
return Ok(KeyEvent {
|
code: KeyCode::Char('-'),
|
||||||
code: KeyCode::Char('-'),
|
modifiers: KeyModifiers::empty(),
|
||||||
modifiers: KeyModifiers::empty(),
|
});
|
||||||
});
|
|
||||||
} else {
|
|
||||||
let suggestion = format!("{}-{}", s.trim_end_matches('-'), keys::MINUS);
|
|
||||||
anyhow::bail!(
|
|
||||||
"Key '-' cannot be used with modifiers, use '{}' instead",
|
|
||||||
suggestion
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
anyhow::bail!("Invalid key code '{}'", s)
|
let suggestion = format!("{}-{}", s.trim_end_matches('-'), keys::MINUS);
|
||||||
|
anyhow::bail!(
|
||||||
|
"Key '-' cannot be used with modifiers, use '{}' instead",
|
||||||
|
suggestion
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
anyhow::bail!("Invalid key code '{}'", s)
|
||||||
};
|
};
|
||||||
let mut modifiers = KeyModifiers::empty();
|
let mut modifiers = KeyModifiers::empty();
|
||||||
for token in tokens {
|
for token in tokens {
|
||||||
|
|
Loading…
Reference in New Issue