Adds a new delete-line key binding defaulting to Control + Shift + Backspace. It has to be before delete-prev-word because otherwise it takes precedence, this seems less restrictive than disallowing bindings to match if additional modifiers are held (and if that is desirable it's unrelated to this). I saw that delete-line-backward was originally named delete-line, is that an issue?
Add delete-line binding #472
bbb651/fuzzel:delete-line-binding into master I use Emacs bindings that already exist for this:
Control-A, Control-K
(Go to beginning of line, kill remainder of line).
If this is to be accepted, I would recommend a clearer name, like "delete-input", as the rows of items to select are also lines.
It has to be before delete-prev-word because otherwise it takes precedence
Moving it before delete-prev-word doesn't actually fix the issue, it just makes the default bindings work (and in a very fragile way, I would add).
The real issue is that is many XKB layouts, shift+backspace is the same as backspace, because the layout considers shift "consumed". This isn't an issue in fuzzel, but in the keyboard layout.
Thus, two better options are:
- Fix the layout (not something we can do in fuzzel)
- Use other defaults. Relying on a specific order of the key binding definitions is not an acceptable solution to me.
I wonder how Emacs maps it, I found this commit which seems relevant, I think they baypass XKB modifier consumption and do it manually somewhere?
A possible option is to special case them, just for the case where the physical key is backspace, the keysym is backspace and shift was consumed (very conservative so it doesn't collide with e.g. remapping it or mapping shift+Backspace to Delete)?
Otherwise, do you have an idea for a default? I'm not used to Emacs bindings so I'll probably change it to Control+a > Backspace, and thought it would make the most sense to match Emacs. Maybe Control+Alt+Backspace or should I leave it unbound?
I think they baypass XKB modifier consumption and do it manually somewhere?
We do that in fuzzel too. We check both translated (symbol as-is from XKB, consumed modifiers), untranslated (unshifted symbol, explicit modifiers) and raw key codes. In that order.
I'm thinking it might be better to check untranslated/unshifted before translated. That would make shift+backspace match before just backspace. Need to think a bit about this, to make sure there's nothing I'm missing.
I still wonder if the desire to delete the whole line quickly is better handled with documentation than code.
This is often handled with a combination of existing bindings. In our case, Control-A, Control-K.
Other apps that support "Select All", they may use "Select All, Delete".
Even the OP here suggests they will use "Control A + Backspace" for the binding. And at which point you are already using three keys.... "Control A Control K" is similar effort and already works. If your keyboard layout allows it, you can hold down Control followed by A and K, making it also three keystrokes.
I still wonder if the desire to delete the whole line quickly is better handled with documentation than code.
I haven't made my final decision yet, but I do tend to agree with this.
#476 should fix the Backspace vs. Shift+Backspace issue. Haven't tested it much yet though, but hopefully it doesn't introduce any other issues...
Fwiw I'm still interested in this.
Even the OP here suggests they will use "Control A + Backspace" for the binding. And at which point you are already using three keys.... "Control A Control K" is similar effort and already works. If your keyboard layout allows it, you can hold down Control followed by A and K, making it also three keystrokes.
That doesn't help because I cannot map Backspace to delete-line-forward. Now that I think about it Control + X is much better, it's easy reachable for a (imo) common function and it's mapped to "cut line" (when you don't have text selected) in most editors, it might even be a better default than the emacs one.
Given that the docs were updated on how to clear a line via the keyboard and #476, is this PR still of interest?
Yes, it’s still not possible to do in a single keybind, IIUC #476 made it possible for Control + Shift + Backspace to be a default keybind in a non fragile way, and like I said I think Control + X is also a good option (more intuitive for more users imo with the trade off of not matching emacs).
I can resolve the conflicts and update the binding if needed.
@bbb651 yes, please rebase on latest master, and clean up the PR
No due date set.
No dependencies set.
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?