sourcegraph / cody

Type less, code more: Cody is an AI code assistant that uses advanced search and codebase context to help you write and fix code.
https://cody.dev
Apache License 2.0
2.55k stars 264 forks source link

Command + Left/Right Arrow Does Not Move Cursor to Start/End of Line in Text Box on Mac #5495

Open FoxMcWeezer opened 1 week ago

FoxMcWeezer commented 1 week ago

Issue: Command + Left/Right Arrow Does Not Move Cursor to Start/End of Line in Text Box on Mac

Description:

When using the text box in the application, the Command + Left Arrow or Command + Right Arrow keyboard shortcuts on macOS do not behave as expected. Normally, in native macOS applications (e.g., Notes, Safari, TextEdit), pressing Command + Left Arrow moves the cursor to the beginning of the line, and pressing Command + Right Arrow moves the cursor to the end of the line.

However, in this specific text box:

Steps to Reproduce:

  1. Open the text box in the application.
  2. Type any text.
  3. Press Command + Left Arrow (on a Mac keyboard).
    • Expected: Cursor should move to the start of the current line.
    • Actual: Cursor does not move.
  4. Press Command + Right Arrow (on a Mac keyboard).
    • Expected: Cursor should move to the end of the current line.
    • Actual: Cursor does not move.

Expected Behavior:

Actual Behavior:

Environment:

Additional Notes:

jdorfman commented 1 week ago

Thanks @FoxMcWeezer sending this to the product team!

sqs commented 1 week ago

Thanks for reporting and sorry for this issue. We will need to upstream a fix to the Lexical editor, which we use for the text editor field. As a partial workaround, Opt+Left/Right Arrow does work to navigate by word/token. And Cmd+Left/Right Arrow does work if the cursor is adjacent to text (but not when it's adjacent to an @-mention chip).

Note to our team: You can repro this at https://playground.lexical.dev/. Insert a poll (which is a DecoratorNode), and then try keyboard navigation with Cmd+Left/Right Arrow.

Internal tracking issue: https://linear.app/sourcegraph/issue/CODY-3686/cmdleftright-arrow-keys-dont-work-in-chat-lexical-editor-when-cursor