Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmd + Backspace doesn't delete entire line #754

Open
ghost opened this issue Sep 23, 2022 · 10 comments
Open

Cmd + Backspace doesn't delete entire line #754

ghost opened this issue Sep 23, 2022 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Sep 23, 2022

Describe the bug
Cmd + Backspace doesn't delete entire line.

Expected behavior
Cmd + Backspace should delete entire line, as per 588fe1a.

Distro: Latest PopOS
DE: Gnome
Branch: master
Commit: latest (e106710)

@ghost ghost added the bug Something isn't working label Sep 23, 2022
@ghost ghost assigned rbreaves Sep 23, 2022
@RedBearAK
Copy link
Contributor

@doplumi

  • What application(s) are you using where this isn't working? Can you run this command and then click on each window where you're having the issue, and show the output? (You may need to install the "xprop" package to get the command to work.)
xprop WM_CLASS _NET_WM_NAME
  • If you stop Kinto using the tray icon menu or Kinto GUI app menu, does the Shift+Ctrl+Backspace shortcut work, or does it do something else?

This shortcut is in the "General" section so it should theoretically work everywhere. But in the current Kinto config the terminals block is below the "General" keymap, and terminals need their own wordwise shortcuts. So if this is about it not working in a terminal app you may need to move the whole "terminals" keymap up so that it comes before the "General" keymap, and insert these lines in the terminals (termStr) keymap to override some of the wordwise shortcuts in the "General" keymap. This issue should be fixed in a future release of Kinto.

define_keymap(re.compile(termStr, re.IGNORECASE),{
    ### wordwise overrides of general GUI block
    K("Alt-Backspace"):         K("Alt-Shift-Backspace"),       # Wordwise delete word left of cursor in terminals
    K("Alt-Delete"):           [K("Esc"),K("d")],               # Wordwise delete word right of cursor in terminals
    K("RC-Backspace"):          K("C-u"),                       # Wordwise delete line left of cursor in terminals
    K("RC-Delete"):             K("C-k"),                       # Wordwise delete line right of cursor in terminals

@kennethkeim
Copy link

I'm on the latest PopOS and having this issue (only in vs code).
Here's the output for the vscode window:

WM_CLASS(STRING) = "code", "Code"
_NET_WM_NAME(UTF8_STRING) = "Untitled (Workspace) - Visual Studio Code"

@RedBearAK
Copy link
Contributor

@kennethkeim

I'm on the latest PopOS and having this issue (only in vs code).

Having the issue in VSCode in general, or in the embedded terminal pane inside VSCode? It's often difficult to get embedded terminals to work correctly because all the keymapper sees is the class/name of the main window in those situations. So the wordwise mappings for "GUI" apps will be active in VSCode, and if you're trying to use the wordwise shortcuts in the embedded terminal they won't be correct.

As far as I know there is no solution to this other than using a separate (external) terminal, if possible.

@kennethkeim
Copy link

That would make sense, but it was just in the text editor. I don't use the embedded terminals in vs code.

@RedBearAK
Copy link
Contributor

@kennethkeim

That would make sense, but it was just in the text editor. I don't use the embedded terminals in vs code.

That is odd.

OK, looks like there is a line in "General" that remaps RC+Backspace to Ctrl+Shift+Backspace for most non-terminal applications, and this is interfering with VSCode, which seems to like Ctrl+Backspace for this "delete line left of cursor" shortcut.

    C("RC-Backspace"):          C("C-Shift-Backspace"),         # Delete Entire Line Left of Cursor

There are some general wordwise shortcuts in the "Codes" specific override keymap, but nothing to fix this particular shortcut. If you find your "Codes" keymap and insert this line (and restart Kinto), it will override the remap above from the "General" block. Unless... if your version of kinto.py has the "Codes" keymap below the "General" block, you'll need to move the entire "Codes" block above the "General" block instead of below it. Or this won't work.

    C("RC-Backspace"):          C("C-Backspace"),                   # Delete Entire Line Left of Cursor

Yeah, looks like the default kinto.py file is still out of the order it should be in. The simplest thing to do is to grab the entire "General GUI" keymap and move it to the very end of the config file. That will make the line above take precedence over the general shortcut while you are in VSCode(s).

The VSCode(s) block starts with this line:

define_keymap(re.compile(codeStr, re.IGNORECASE),{

Tested the fix in VSCode, VSCodium and "Code - OSS". Working for me now.

Let me know if you have trouble making this work.

@ian-h-chamberlain
Copy link

ian-h-chamberlain commented Jan 15, 2023

I was having this issue in the Firefox URL bar, not sure if it applies to other browsers, but I was able to workaround it with

    K("RC-Backspace"): K("C-u"),    # Delete Entire Line Left of Cursor
	# edit: actually C-k seems like it doesn't work how I thought it did...
    K("RC-Delete"): K("C-k"),    # Delete Entire Line Left of Cursor

Unfortunately, this breaks shortcuts in textareas, since C-u and C-k have other meanings in a non-URL bar context (I think the default C-Shift-Backspace and C-Shift-Delete probably work correctly here).
I'd imagine that some Firefox config might be needed to change the shortcut behavior (if there isn't one that works in both places), since as I understand it xkeysnail doesn't have access to that context information.

Edit: Aha! This combo seems to work in both the URL bar and the textarea editors, although it feels slightly hacky to select, then delete text:

    K("RC-Backspace"): [K("Shift-Home"), K("Backspace")], # Delete Entire Line Left of Cursor
    K("RC-Delete"): [K("Shift-End"), K("Delete")],        # Delete Entire Line Right of Cursor

@RedBearAK
Copy link
Contributor

@ian-h-chamberlain

This combo seems to work in both the URL bar and the textarea editors

Nice solution.

feels slightly hacky to select, then delete text

If it works, it works. Would need to be tested in multiple browsers before trying to use it as a general solution.

@RedBearAK
Copy link
Contributor

RedBearAK commented Jan 16, 2023

@ian-h-chamberlain

After some testing, your solution for Firefox wordwise delete to end-of-line or beginning-of-line shortcuts seems like a good candidate for inclusion in the default Kinto config. The Chrome browsers don't seem to have any issue with the existing shortcuts working both in text areas on a page and in the URL bar.

I have a system that is notorious for being weirdly slow to perform macros, but I don't even see it highlighting the text before deletion, unless it's quite a lot of text in the URL bar. Works really well.

I think I'll put together a PR to have it added to the Kinto config.

Edit: #780

@kennethkeim
Copy link

@RedBearAK Thanks for the info, I still can't get that to work. I tried your suggestions and restarted but the issue is still there.

@kennethkeim
Copy link

@ian-h-chamberlain I added your lines to the general gui section and the vscode section, and it seems to work well in both. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants