@@ -85,6 +85,27 @@ impl Prompt {
85 self.exit_selection();
85 self.exit_selection();
88+ pub fn delete_word_backwards(&mut self) {
89+ use helix_core::get_general_category;
90+ let mut chars = self.line.char_indices().rev();
91+ // TODO add skipping whitespace logic here
92+ let (mut i, cat) = match chars.next() {
93+ Some((i, c)) => (i, get_general_category(c)),
97+ for (nn, nc) in chars {
98+ if get_general_category(nc) != cat {
104+ self.line.drain(i..);
105+ self.completion = (self.completion_fn)(&self.line);
106+ self.exit_selection();
88 pub fn change_completion_selection(&mut self, direction: CompletionDirection) {
109 pub fn change_completion_selection(&mut self, direction: CompletionDirection) {
89 if self.completion.is_empty() {
110 if self.completion.is_empty() {
@@ -270,6 +291,10 @@ impl Component for Prompt {
270 code: KeyCode::Char('a'),
291 code: KeyCode::Char('a'),
271 modifiers: KeyModifiers::CONTROL,
292 modifiers: KeyModifiers::CONTROL,
272 } => self.move_start(),
293 } => self.move_start(),
295+ code: KeyCode::Char('w'),
296+ modifiers: KeyModifiers::CONTROL,
297+ } => self.delete_word_backwards(),
273 KeyEvent {
298 KeyEvent {
274 code: KeyCode::Backspace,
299 code: KeyCode::Backspace,
275 modifiers: KeyModifiers::NONE,
300 modifiers: KeyModifiers::NONE,