getcursor / cursor

The AI Code Editor
https://cursor.com
25.02k stars 1.55k forks source link

Multiple Issues with Custom Keybindings and Hotkey Functionality #1685

Open ratiomark opened 2 months ago

ratiomark commented 2 months ago

System Specifications:

Please note that while I’m using Windows 11, the system displays it as "Windows_NT x64 10.0.22631" due to the way the operating system versions are reported internally.

Hello,

I’m experiencing several issues related to custom keybindings and the general functionality of hotkeys. Below are the details:

  1. Custom Keybinding for Closing Prompt Bar:

    • I set Ctrl + B as the keybinding to close the prompt bar using the following configuration in keybindings.json:
      {
       "key": "ctrl+b",
       "command": "aipopup.action.closePromptBar",
       "when": "editorHasPromptBar && editorPromptBarFocused && editorTextFocus"
      },
      {
       "key": "escape",
       "command": "-aipopup.action.closePromptBar",
       "when": "editorHasPromptBar && editorPromptBarFocused && editorTextFocus"
      }
    • Although the prompt window indicates that "Ctrl+B" should close it (as shown in the attached screenshot, pressing Ctrl + B does not have any effect. The window still only closes using Esc.
  2. Hotkey Functionality Inside Prompt Bar and AI Chat:

    • When I am inside the prompt bar or chatting with the AI, none of the standard VS Code hotkeys seem to work. For instance:
      • Ctrl + Shift + P does not bring up the Command Palette.
      • Ctrl + ` (for switching to the terminal) is also unresponsive.
    • Essentially, any hotkeys unrelated to the prompt or chat functionality become non-functional when either of these is active.
  3. Custom Hotkey for Chat Dropdown:

    • I attempted to change the aichat.showchatdropdown command from Ctrl + Alt + L to Ctrl + Alt + M. The UI reflects this change, as seen in the attached screenshot. However, pressing Ctrl + Alt + M does nothing, while the original Ctrl + Alt + L still works.
    • The keybinding used is as follows:
      {
      "key": "ctrl+alt+l",
      "command": "-aichat.showchatdropdown"
      },
      {
      "key": "ctrl+alt+m",
      "command": "aichat.showchatdropdown"
      }
    • This suggests that the new keybinding isn’t being recognized correctly, and the command still defaults to the old keybinding.

I would appreciate it if you could look into these issues.

Please add the bug label to this issue if applicable

mjmaurer commented 2 weeks ago

This may be related. Only some keybindings work with the cursor chat panel text input is focused. I've pasted some keybinding logs below. First, you can see an example of the alt-o command working when focused on the editor. Beginning at 00:42:29.858, you can see the alt-o command failing when the chat text input is focused. This is true for other bindings like cmd+o as well.

Interestingly, other custom keybindings (such as alt-t) work with the chat text input focused.

2024-10-24 00:42:18.573 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-10-24 00:42:18.575 [info] [KeybindingService]: \ Keyboard event cannot be dispatched
2024-10-24 00:42:18.575 [info] [KeybindingService]: / Received  keydown event - modifiers: [alt], code: AltRight, keyCode: 18, key: Alt
2024-10-24 00:42:18.576 [info] [KeybindingService]: | Converted keydown event - modifiers: [alt], code: AltRight, keyCode: 6 ('Alt')
2024-10-24 00:42:18.576 [info] [KeybindingService]: \ Keyboard event cannot be dispatched in keydown phase.
2024-10-24 00:42:18.580 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-10-24 00:42:18.581 [info] [KeybindingService]: | Resolving alt+O
2024-10-24 00:42:18.581 [info] [KeybindingService]: \ From 2 keybinding entries, matched terminal.focus, when: no when condition, source: user.
2024-10-24 00:42:18.581 [info] [KeybindingService]: / Received  keydown event - modifiers: [alt], code: KeyO, keyCode: 79, key: Unidentified
2024-10-24 00:42:18.581 [info] [KeybindingService]: | Converted keydown event - modifiers: [alt], code: KeyO, keyCode: 45 ('O')
2024-10-24 00:42:18.581 [info] [KeybindingService]: | Resolving alt+O
2024-10-24 00:42:18.581 [info] [KeybindingService]: \ From 2 keybinding entries, matched terminal.focus, when: no when condition, source: user.
2024-10-24 00:42:18.581 [info] [KeybindingService]: + Invoking command terminal.focus.
2024-10-24 00:42:18.674 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-10-24 00:42:18.674 [info] [KeybindingService]: | Resolving alt+O
2024-10-24 00:42:18.675 [info] [KeybindingService]: \ From 2 keybinding entries, matched terminal.focus, when: no when condition, source: user.
2024-10-24 00:42:18.733 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-10-24 00:42:18.736 [info] [KeybindingService]: \ Keyboard event cannot be dispatched
2024-10-24 00:42:18.736 [info] [KeybindingService]: + Ignoring single modifier alt due to it being pressed together with other keys.
2024-10-24 00:42:29.858 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-10-24 00:42:29.858 [info] [KeybindingService]: \ Keyboard event cannot be dispatched
2024-10-24 00:42:29.858 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-10-24 00:42:29.864 [info] [KeybindingService]: | Resolving alt+O
2024-10-24 00:42:29.864 [info] [KeybindingService]: \ From 2 keybinding entries, matched terminal.focus, when: no when condition, source: user.
2024-10-24 00:42:30.041 [info] [KeybindingService]: + Ignoring single modifier alt due to it being pressed together with other keys.