Skip to content
Myr

implement ctrl-u (erase before cursor) keybinding

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Zi How Poh · committed by Daniel Eklöf · parent c1fdcb7 · Browse files · 8 files+40 added−8 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

8 files+40 added−8 removed

  • other:+40 added−8 removed

8 files+40 added−8 removed

modified:doc/fuzzel.ini.5.scd+6 added-3 removed
299 unmodified lines
300*xkbcli interactive-wayland* can be useful for finding keysym names.301302A key combination can only be mapped to *one* action. Lets say you303want to bind *Control+k* to *next*. Since this is the default shortcut304for *delete-line*, you must unmap the default binding. This can be305done by setting _action=none_; e.g. *delete-line=none*.304for *delete-line-forward*, you must unmap the default binding. This can be305done by setting _action=none_; e.g. *delete-line-forward=none*.306307*cancel*308 Quite fuzzel without executing anythingDefault: _Control+g309 Control+c Escape_.
43 unmodified lines
353*delete-prev-word*354 Deletes the **word before** the cursor. Default: _Mod1+BackSpace355 Control+BackSpace_.356357*delete-line-backward*358 Deletes everything before the cursor. Default: _Control+u_.359360*delete-next*361 Deletes the **character after** the cursor. Default: _Delete_.362363*delete-next-word*364 Deletes the **word after** the cursor. Default: _Mod1+d365 Control+Delete_.366364*delete-line*367*delete-line-forward*368 Deletes everything after the cursor. Default: _Control+k_.369370*insert-selected*371 Copies the selected entry to the prompt, replacing the current
63 unmodified lines
modified:CHANGELOG.md+5 added
38 unmodified lines
39 matches the given string ([#237][237]).40* `include=<path>` option to `fuzzel.ini` ([#205][205]).41* New option `--list-executables-in-path` add executables presents in42 the $PATH variable to the list ([#284][284]).43* New key binding: `delete-line-backward` which corresponds to C-u in bash.44 Also renames `delete-line` to `delete-line-forward` ([#307][307]).4546[130]: https://codeberg.org/dnkl/fuzzel/issues/13047[264]: https://codeberg.org/dnkl/fuzzel/issues/26448[252]: https://codeberg.org/dnkl/fuzzel/issues/25249[237]: https://codeberg.org/dnkl/fuzzel/issues/23750[205]: https://codeberg.org/dnkl/fuzzel/issues/20551[284]: https://codeberg.org/dnkl/fuzzel/pulls/28452[307]: https://codeberg.org/dnkl/fuzzel/pulls/307535455### Changed56
1 unmodified line
58* Selection color is now painted over background color ([#255][255]).59* Exact matches (of the application title) are now sorted first60 ([#259][259]).61* Set default log level to warning ([#266][266]).62* Rename `delete-line` binding to `delete-line-forward` ([#307][307]).6364[255]: https://codeberg.org/dnkl/fuzzel/issues/25565[259]: https://codeberg.org/dnkl/fuzzel/issues/25966[266]: https://codeberg.org/dnkl/fuzzel/pulls/26667[307]: https://codeberg.org/dnkl/fuzzel/pulls/307686970### Deprecated71### Removed
555 unmodified lines
modified:config.c+4 added-2 removed
44 unmodified lines
45 [BIND_ACTION_CURSOR_RIGHT] = "cursor-right",46 [BIND_ACTION_CURSOR_RIGHT_WORD] = "cursor-right-word",47 [BIND_ACTION_DELETE_PREV] = "delete-prev",48 [BIND_ACTION_DELETE_PREV_WORD] = "delete-prev-word",49 [BIND_ACTION_DELETE_LINE_BACKWARD] = "delete-line-backward",50 [BIND_ACTION_DELETE_NEXT] = "delete-next",51 [BIND_ACTION_DELETE_NEXT_WORD] = "delete-next-word",51 [BIND_ACTION_DELETE_LINE] = "delete-line",52 [BIND_ACTION_DELETE_LINE_FORWARD] = "delete-line-forward",53 [BIND_ACTION_INSERT_SELECTED] = "insert-selected",54 [BIND_ACTION_MATCHES_EXECUTE] = "execute",55 [BIND_ACTION_MATCHES_EXECUTE_OR_NEXT] = "execute-or-next",56 [BIND_ACTION_MATCHES_EXECUTE_INPUT] = "execute-input",
1388 unmodified lines
1445 {BIND_ACTION_DELETE_NEXT_WORD, m_alt, {{XKB_KEY_d}}},1446 {BIND_ACTION_DELETE_NEXT_WORD, m_ctrl, {{XKB_KEY_Delete}}},1447 {BIND_ACTION_DELETE_NEXT_WORD, m_ctrl, {{XKB_KEY_KP_Delete}}},14481448 {BIND_ACTION_DELETE_LINE, m_ctrl, {{XKB_KEY_k}}},1449 {BIND_ACTION_DELETE_LINE_BACKWARD, m_ctrl, {{XKB_KEY_u}}},1450 {BIND_ACTION_DELETE_LINE_FORWARD, m_ctrl, {{XKB_KEY_k}}},14511452 {BIND_ACTION_INSERT_SELECTED, m_ctrl, {{XKB_KEY_Tab}}},14531454 {BIND_ACTION_MATCHES_EXECUTE, m_none, {{XKB_KEY_Return}}},
190 unmodified lines
modified:fuzzel.ini+2 added-1 removed
57 unmodified lines
58# cursor-home=Home Control+a59# cursor-end=End Control+e60# delete-prev=BackSpace61# delete-prev-word=Mod1+BackSpace Control+BackSpace62# delete-line-backward=Control+u63# delete-next=Delete KP_Delete Control+d64# delete-next-word=Mod1+d Control+Delete Control+KP_Delete64# delete-line=Control+k65# delete-line-forward=Control+k66# prev=Up Control+p67# prev-with-wrap=ISO_Left_Tab68# prev-page=Page_Up KP_Page_Up69# next=Down Control+n
26 unmodified lines
modified:key-binding.h+2 added-1 removed
14 unmodified lines
15 BIND_ACTION_CURSOR_RIGHT,16 BIND_ACTION_CURSOR_RIGHT_WORD,17 BIND_ACTION_DELETE_PREV,18 BIND_ACTION_DELETE_PREV_WORD,19 BIND_ACTION_DELETE_LINE_BACKWARD,20 BIND_ACTION_DELETE_NEXT,21 BIND_ACTION_DELETE_NEXT_WORD,21 BIND_ACTION_DELETE_LINE,22 BIND_ACTION_DELETE_LINE_FORWARD,23 BIND_ACTION_INSERT_SELECTED,2425 BIND_ACTION_MATCHES_EXECUTE,26 BIND_ACTION_MATCHES_EXECUTE_OR_NEXT,
75 unmodified lines
modified:prompt.c+13 added
261 unmodified lines
262{263 prompt->text[prompt->cursor] = U'\0';264 return true;265}266267bool268prompt_erase_before_cursor(struct prompt *prompt)269{270 if (prompt->cursor == 0) {271 return false;272 }273 memmove(&prompt->text[0],274 &prompt->text[prompt->cursor],275 (c32len(prompt->text) - prompt->cursor + 1) * sizeof(char32_t));276 prompt->cursor = 0;277 return true;278}
modified:prompt.h+1 added
25 unmodified lines
26bool prompt_erase_prev_char(struct prompt *prompt);27bool prompt_erase_next_word(struct prompt *prompt);28bool prompt_erase_prev_word(struct prompt *prompt);29bool prompt_erase_after_cursor(struct prompt *prompt);30bool prompt_erase_before_cursor(struct prompt *prompt);
modified:wayland.c+7 added-1 removed
594 unmodified lines
595 if (*refresh)596 matches_update(wayl->matches, wayl->prompt);597 return true;598599 case BIND_ACTION_DELETE_LINE_BACKWARD:600 *refresh = prompt_erase_before_cursor(wayl->prompt);601 if (*refresh)602 matches_update(wayl->matches, wayl->prompt);603 return true;604605 case BIND_ACTION_DELETE_NEXT:606 *refresh = prompt_erase_next_char(wayl->prompt);607 if (*refresh)608 matches_update(wayl->matches, wayl->prompt);
4 unmodified lines
613 if (*refresh)614 matches_update(wayl->matches, wayl->prompt);615 return true;616611 case BIND_ACTION_DELETE_LINE:617 case BIND_ACTION_DELETE_LINE_FORWARD:618 *refresh = prompt_erase_after_cursor(wayl->prompt);619 if (*refresh)620 matches_update(wayl->matches, wayl->prompt);621 return true;
1595 unmodified lines