Allow for specifying whether to select the search input content when activated #5

Merged
marcuswestin merged 3 commits from add-search-config-to-select-search-input-content-on-activation into main 2021-09-06 09:45:33 +02:00
marcuswestin commented 2021-09-04 17:47:15 +02:00 (Migrated from github.com)

Prior to this change, when I used the search panel multiple times in the same document the previous search input wouldn't be cleared when I hit Cmd+F.

This patch addresses this problem by adding a "select" option to the search config.

Steps to demo intended behavior

  • Hit Cmd+f
  • Type in "foo". Editor correctly finds "foo"
  • Hit escape
  • Hit Cmd+f
  • Type in "bar". Editor finds "foobar" instead of my expected "bar".

Adding the option "select" means that the previous content "foo" is selected by default when focusing on the search input with Cmd+f, so typing "bar" overrides the previous input.

Prior to this change, when I used the search panel multiple times in the same document the previous search input wouldn't be cleared when I hit Cmd+F. This patch addresses this problem by adding a "select" option to the search config. Steps to demo intended behavior - Hit Cmd+f - Type in "foo". Editor correctly finds "foo" - Hit escape - Hit Cmd+f - Type in "bar". Editor finds "foobar" instead of my expected "bar". Adding the option "select" means that the previous content "foo" is selected by default when focusing on the search input with Cmd+f, so typing "bar" overrides the previous input.
marijnh commented 2021-09-04 18:00:03 +02:00 (Migrated from github.com)

I'm actually fine with this being the default and only behavior. But, interestingly, it already works this way for me on Chrome and Firefox (focusing the input selects its content). Which browser are you using (or which specific actions do you perform) where it doesn't select the content?

I'm actually fine with this being the default and only behavior. But, interestingly, it already works this way for me on Chrome and Firefox (focusing the input selects its content). Which browser are you using (or which specific actions do you perform) where it doesn't select the content?
marcuswestin commented 2021-09-04 18:14:12 +02:00 (Migrated from github.com)

Interesting. I use CodeMirror inside Electron.

I believe we should make it behave the same across all platforms. Making it select by default sounds right to me, since it's definitely the most common search input behavior across platforms and apps.

I'll update this patch.

Interesting. I use CodeMirror inside Electron. I believe we should make it behave the same across all platforms. Making it select by default sounds right to me, since it's definitely the most common search input behavior across platforms and apps. I'll update this patch.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
codemirror/search!5
No description provided.