keyfork-prompt: improve delete-word handling
This commit is contained in:
parent
27e7aba901
commit
5e62d8909d
|
@ -111,7 +111,16 @@ where
|
|||
input.pop();
|
||||
}
|
||||
KeyCode::Char('w') if k.modifiers.contains(KeyModifiers::CONTROL) => {
|
||||
while input.pop().is_some_and(|c| !c.is_whitespace()) {}
|
||||
let mut has_deleted_text = true;
|
||||
while input.pop().is_some_and(char::is_whitespace) {
|
||||
has_deleted_text = false;
|
||||
}
|
||||
while input.pop().is_some_and(|c| !c.is_whitespace()) {
|
||||
has_deleted_text = true;
|
||||
}
|
||||
if !input.is_empty() && has_deleted_text {
|
||||
input.push(' ');
|
||||
}
|
||||
}
|
||||
KeyCode::Char(' ') => {
|
||||
if !input.chars().rev().next().is_some_and(char::is_whitespace) {
|
||||
|
|
Loading…
Reference in New Issue