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

Search keymap: ctrl+d produces multiple selections even when allowMultipleSelections is false #1288

Closed
personalizedrefrigerator opened this issue Nov 2, 2023 · 3 comments

Comments

@personalizedrefrigerator
Copy link

personalizedrefrigerator commented Nov 2, 2023

Describe the issue

With the search keymap enabled, selecting text that appears multiple times then pressing ctrl+d selects all occurrences of that text, even when EditorState.allowMultipleSelections.of(false) is provided as an extension.

Steps to reproduce:

  1. Open the linked example
  2. Select test
  3. Press ctrl+d
  4. Type replaced
  5. Comment out drawSelection()
  6. Re-run
  7. Repeat steps 1-4

After step 4 (both times), both occurrences of test are replaced with replaced.

Browser and platform

Firefox 119.0, Ubuntu 23.10

Reproduction link

https://codemirror.net/try/?c=aW1wb3J0IHtFZGl0b3JTdGF0ZX0gZnJvbSAiQGNvZGVtaXJyb3Ivc3RhdGUiCmltcG9ydCB7ZHJhd1NlbGVjdGlvbiwgRWRpdG9yVmlldywga2V5bWFwLCBoaWdobGlnaHRTcGVjaWFsQ2hhcnN9IGZyb20gIkBjb2RlbWlycm9yL3ZpZXciCmltcG9ydCB7IHNlYXJjaCwgc2VhcmNoS2V5bWFwLCBoaWdobGlnaHRTZWxlY3Rpb25NYXRjaGVzIH0gZnJvbSAnQGNvZGVtaXJyb3Ivc2VhcmNoJwoKCm5ldyBFZGl0b3JWaWV3KHsKICBkb2M6ICJ0ZXN0IHRlc3QiLAogIGV4dGVuc2lvbnM6IFsKICAgIGRyYXdTZWxlY3Rpb24oKSwKICAgIEVkaXRvclN0YXRlLmFsbG93TXVsdGlwbGVTZWxlY3Rpb25zLm9mKGZhbHNlKSwKICAgIHNlYXJjaCgpLAogICAga2V5bWFwLm9mKFsKICAgICAgLi4uc2VhcmNoS2V5bWFwCiAgICBdKQogIF0sCiAgcGFyZW50OiBkb2N1bWVudC5ib2R5Cn0pCg==

@marijnh
Copy link
Member

marijnh commented Nov 2, 2023

allowMultipleSelections is enabled when any extension enables it. So if it is already there, adding another value of false to your configuration will not change anything.

@marijnh
Copy link
Member

marijnh commented Nov 2, 2023

That being said, there was a bug where that facet wasn't actually being checked on state updates! Attached patch fixes it.

@personalizedrefrigerator
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants