Skip to content

Commit

Permalink
ctrl+backspace for removing word
Browse files Browse the repository at this point in the history
  • Loading branch information
l4l committed Dec 26, 2020
1 parent 727d0af commit b3fca99
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ These cannot be configured yet, so the following keys are handled:
- **Up**/**Down** — select item at the menu;
- **Return** — launches selected app;
- **Ctrl+]** — clears the input.
- **Ctrl+w** — erases a single word (i.e. until first alphanumeric symbol).
- **Ctrl+w**/**Ctrl+Backspace** — erases a single word (i.e. until first alphanumeric symbol).
6 changes: 6 additions & 0 deletions src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ impl State {
} => return true,
KeyPress {
keysym: keysyms::XKB_KEY_BackSpace,
ctrl: false,
..
} => {
self.input_buf.pop();
Expand Down Expand Up @@ -113,6 +114,11 @@ impl State {
keysym: keysyms::XKB_KEY_w,
ctrl: true,
..
}
| KeyPress {
keysym: keysyms::XKB_KEY_BackSpace,
ctrl: true,
..
} => {
if let Some(pos) = self.input_buf.rfind(|x: char| !x.is_alphanumeric()) {
self.input_buf.truncate(pos);
Expand Down

0 comments on commit b3fca99

Please sign in to comment.