atom / find-and-replace

Find and replace in a single buffer and in the project
MIT License
242 stars 196 forks source link

Pressing cmd-d once is selecting more than just the "next" match #936

Closed alexcroox closed 7 years ago

alexcroox commented 7 years ago

Description

Pressing cmd-d once is selecting more than just the "next" match

ss

Steps to Reproduce

  1. Double click to highlight a word
  2. Press cmd-d once

Expected behavior: Expect it to highlight/select just the next match

Actual behavior: It selects multiple matches, not all, just a bunch, the number it selects seems quite random and doesn't follow any logic I can work out (not all, not all in view)

Reproduces how often: [What percentage of the time does it reproduce?]

Versions

You can get this information from copy and pasting the output of atom --version and apm --version from the command line. Also, please include the OS and what version of the OS you're running.

MacOS 10.12.5

Atom : 1.18.0 Electron: 1.3.15 Chrome : 52.0.2743.82 Node : 6.5.0 apm 1.18.1 npm 3.10.10 node 6.9.5 x64 python 2.7.10 git 2.13.3

Additional information Here are my keybindings to make sure nothing is conflicting

ss2

alexcroox commented 7 years ago

Restarting atom fixed this 🤕

carsondarling commented 7 years ago

I'm now experiencing the same issue. Restarting Atom seemed to fix it temporarily, but it quickly came back. The bug only happens when I already have text selected. If there's no selection, it appears to work fine.

yannickcr commented 7 years ago

I have exactly the same issue :cry:

Linux Mint 18 KDE 64-bit

$ atom --version
Atom    : 1.19.0
Electron: 1.6.9
Chrome  : 56.0.2924.87
Node    : 7.4.0

$ apm --version
apm  1.18.2
npm  3.10.10
node 6.9.5 x64
python 2.7.12
git 2.7.4
alexcroox commented 7 years ago

@carsondarling @yannickcr do you use this package https://atom.io/packages/highlight-selected

I can't say for sure removing it solved the issue for me, but the day I decided to try figure what was causing it I removed a whole bunch of packages that might be related, and added the following to my keymap:

'.platform-darwin atom-text-editor':
  'cmd-k': 'find-and-replace:select-skip'
  'cmd-d': 'find-and-replace:select-next'

One thing I did notice is by default the keybinding for find-and-replace:select-skip is cmd-k cmd-d which is why you can see I've manually set it to cmd-k without the cmd-d.

I wonder if it's a bug introduced in the past week by 1 of the packages as I've had no issues for months relating to it until less than a week ago.

yannickcr commented 7 years ago

@alexcroox Yes, I'm using highlight-selected, I will try to remove it to see if it solve the issue.

carsondarling commented 7 years ago

@alexcroox I'm also using highlight-selected, I disabled it and am still having the issue.

alexcroox commented 7 years ago

Even after restarting atom and altering the keybinds I posted?

yannickcr commented 7 years ago

Uninstalled highlight-selected but the bug still comes back after a while :(

Here's my packages list:

$ apm list
Built-in Atom Packages (91)
├── atom-dark-syntax@0.28.0
├── atom-dark-ui@0.53.0
├── atom-light-syntax@0.29.0
├── atom-light-ui@0.46.0
├── base16-tomorrow-dark-theme@1.5.0
├── base16-tomorrow-light-theme@1.5.0
├── one-dark-ui@1.10.5
├── one-light-ui@1.10.5
├── one-dark-syntax@1.7.1
├── one-light-syntax@1.7.1
├── solarized-dark-syntax@1.1.2
├── solarized-light-syntax@1.1.2
├── about@1.7.6
├── archive-view@0.63.3
├── autocomplete-atom-api@0.10.1
├── autocomplete-css@0.16.2
├── autocomplete-html@0.8.0
├── autocomplete-plus@2.35.5
├── autocomplete-snippets@1.11.0
├── autoflow@0.29.0
├── autosave@0.24.3
├── background-tips@0.27.1
├── bookmarks@0.44.4
├── bracket-matcher@0.86.0
├── command-palette@0.40.4
├── dalek@0.2.1
├── deprecation-cop@0.56.7
├── dev-live-reload@0.47.1
├── encoding-selector@0.23.4
├── exception-reporting@0.41.4
├── find-and-replace@0.208.3
├── fuzzy-finder@1.5.8
├── github@0.3.4-0
├── git-diff@1.3.6
├── go-to-line@0.32.1
├── grammar-selector@0.49.5
├── image-view@0.61.2
├── incompatible-packages@0.27.3
├── keybinding-resolver@0.38.0
├── line-ending-selector@0.7.3
├── link@0.31.3
├── markdown-preview@0.159.12
├── metrics@1.2.6
├── notifications@0.67.2
├── open-on-github@1.2.1 (disabled)
├── package-generator@1.1.1
├── settings-view@0.250.0
├── snippets@1.1.4
├── spell-check@0.71.4
├── status-bar@1.8.11
├── styleguide@0.49.6
├── symbols-view@0.116.1
├── tabs@0.106.2
├── timecop@0.36.0
├── tree-view@0.217.2
├── update-package-dependencies@0.12.0
├── welcome@0.36.4
├── whitespace@0.37.2
├── wrap-guide@0.40.2
├── language-c@0.58.1
├── language-clojure@0.22.3
├── language-coffee-script@0.48.7
├── language-csharp@0.14.2
├── language-css@0.42.2
├── language-gfm@0.89.1
├── language-git@0.19.1
├── language-go@0.44.1
├── language-html@0.47.3
├── language-hyperlink@0.16.1
├── language-java@0.27.2
├── language-javascript@0.126.1
├── language-json@0.19.1
├── language-less@0.32.0
├── language-make@0.22.3
├── language-mustache@0.14.1
├── language-objective-c@0.15.1
├── language-perl@0.37.0
├── language-php@0.39.0
├── language-property-list@0.9.1
├── language-python@0.45.3
├── language-ruby@0.71.1
├── language-ruby-on-rails@0.25.2
├── language-sass@0.59.0
├── language-shellscript@0.25.1
├── language-source@0.9.0
├── language-sql@0.25.6
├── language-text@0.7.3
├── language-todo@0.29.1
├── language-toml@0.18.1
├── language-xml@0.35.1
└── language-yaml@0.30.0

Community Packages (19) /home/yannick/.atom/packages
├── Sublime-Style-Column-Selection@1.7.4
├── Zen@0.18.0
├── autoclose-html@0.23.0
├── busy-signal@1.4.3
├── chester-atom-syntax@0.2.1
├── editorconfig@2.2.2
├── file-icons@2.1.10
├── intentions@1.1.5
├── language-babel@2.69.0
├── language-docker@1.1.8
├── linter@2.2.0
├── linter-docker@0.2.0
├── linter-eslint@8.2.1
├── linter-stylelint@4.0.1
├── linter-ui-default@1.6.4
├── minimap@4.29.6
├── project-plus@1.0.0
├── sync-settings@0.8.2
└── tabs-to-spaces@1.0.3

I will make more tests

carsondarling commented 7 years ago

@alexcroox I'm still seeing it even after restarting & using the keybindings

alexcroox commented 7 years ago

You are right this issue has randomly returned for me today after being fixed for a few days, I've not changed any package settings...

I think this issue started when I upgraded to Atom 1.190, can't be 100% sure though

Ben3eeE commented 7 years ago

Is someone able to reproduce this in safe mode atom --safe? This helps rule out if it is being caused by a community package or a bug in Atom. Also it would be great if you can give some information about what you were doing before running into this issue to help reproduce.

carsondarling commented 7 years ago

I'm a brand new Atom user, so I can't comment on previous versions. It appears to me that the issue crops up when I've been working with multiple selections for a while. I very frequently use find-and-replace:select-all and find-and-replace:select-next, and I clear the multi-selection by pressing escape, which is bound to editor:consolidate-selections.

The issue never pops up when Atom is first started, and it's only after I've used multi-selection a few times that it will start having the erratic behavior.

Also, it appears that the longer I'm using Atom, the more instances will be selected when I use find-and-replace:select-next. If I had to put forward a guess, I would say that the multiple cursors aren't getting consolidated, and are instead being set to the same location.

I'll start working with Atom in safe mode and see if I can reproduce it.

Thank you all for helping with this one!

carsondarling commented 7 years ago

So over the last several days, I've been trying to use atom --safe whenever possible, and haven't been able to reproduce the issue in safe mode. That being said, my workflow is heavily dependent on 3rd party packages, so I haven't spent as much time in safe mode as I would have liked. Is there anything else I can do to help provide information?

Ben3eeE commented 7 years ago

Thanks for testing in safe mode. What is your output of apm list?

carsondarling commented 7 years ago
Built-in Atom Packages (91)
├── atom-dark-syntax@0.28.0
├── atom-dark-ui@0.53.0
├── atom-light-syntax@0.29.0
├── atom-light-ui@0.46.0
├── base16-tomorrow-dark-theme@1.5.0
├── base16-tomorrow-light-theme@1.5.0
├── one-dark-ui@1.10.5
├── one-light-ui@1.10.5
├── one-dark-syntax@1.7.1
├── one-light-syntax@1.7.1
├── solarized-dark-syntax@1.1.2
├── solarized-light-syntax@1.1.2
├── about@1.7.6
├── archive-view@0.63.3
├── autocomplete-atom-api@0.10.1
├── autocomplete-css@0.16.2
├── autocomplete-html@0.8.0
├── autocomplete-plus@2.35.5
├── autocomplete-snippets@1.11.0
├── autoflow@0.29.0
├── autosave@0.24.3
├── background-tips@0.27.1
├── bookmarks@0.44.4
├── bracket-matcher@0.86.0
├── command-palette@0.40.4
├── dalek@0.2.1
├── deprecation-cop@0.56.7
├── dev-live-reload@0.47.1
├── encoding-selector@0.23.4
├── exception-reporting@0.41.4
├── find-and-replace@0.208.3
├── fuzzy-finder@1.5.8
├── github@0.3.4-0
├── git-diff@1.3.6
├── go-to-line@0.32.1
├── grammar-selector@0.49.5
├── image-view@0.61.2
├── incompatible-packages@0.27.3
├── keybinding-resolver@0.38.0
├── line-ending-selector@0.7.3
├── link@0.31.3
├── markdown-preview@0.159.12
├── metrics@1.2.6
├── notifications@0.67.2
├── open-on-github@1.2.1
├── package-generator@1.1.1
├── settings-view@0.250.0
├── snippets@1.1.4
├── spell-check@0.71.4
├── status-bar@1.8.11
├── styleguide@0.49.6
├── symbols-view@0.116.1
├── tabs@0.106.2
├── timecop@0.36.0
├── tree-view@0.217.2 (disabled)
├── update-package-dependencies@0.12.0
├── welcome@0.36.4
├── whitespace@0.37.2
├── wrap-guide@0.40.2
├── language-c@0.58.1
├── language-clojure@0.22.3
├── language-coffee-script@0.48.7
├── language-csharp@0.14.2
├── language-css@0.42.2
├── language-gfm@0.89.1
├── language-git@0.19.1
├── language-go@0.44.1
├── language-html@0.47.3
├── language-hyperlink@0.16.1
├── language-java@0.27.2
├── language-javascript@0.126.1
├── language-json@0.19.1
├── language-less@0.32.0
├── language-make@0.22.3
├── language-mustache@0.14.1
├── language-objective-c@0.15.1
├── language-perl@0.37.0
├── language-php@0.39.0
├── language-property-list@0.9.1
├── language-python@0.45.3
├── language-ruby@0.71.1
├── language-ruby-on-rails@0.25.2
├── language-sass@0.59.0
├── language-shellscript@0.25.1
├── language-source@0.9.0
├── language-sql@0.25.6
├── language-text@0.7.3
├── language-todo@0.29.1
├── language-toml@0.18.1
├── language-xml@0.35.1
└── language-yaml@0.30.0

Community Packages (28) /Users/cdarling/.atom/packages
├── MagicPython@1.0.11
├── atom-handlebars@1.3.0
├── busy-signal@1.4.3
├── docblockr@0.11.0
├── file-icons@2.1.10
├── haskell-grammar@0.4.0
├── highlight-selected@0.13.1 (disabled)
├── intentions@1.1.5
├── language-babel@2.69.0
├── language-docker@1.1.8
├── language-graphql@0.9.0
├── language-ini@1.19.0
├── language-lua@0.9.11
├── language-ocaml@1.9.5
├── language-rust@0.4.12
├── language-swift@0.5.0
├── language-thrift@1.0.2
├── linter@2.2.0
├── linter-eslint@8.2.1
├── linter-ui-default@1.6.4
├── nuclide@0.243.0
├── nuclide-format-js@0.0.41
├── prettier-atom@0.37.0
├── project-manager@3.3.5
├── project-quick-open@0.5.0
├── set-syntax@0.3.2
├── sort-lines@0.14.0
└── tool-bar@1.1.0
philchanet commented 7 years ago

Adding the two key bindings suggested by @alexcroox solved the problem for me (Atom 1.19.3). Thanks for the tip!

alexcroox commented 7 years ago

No worries but unfortunately the issue returned for me a week later

Ben3eeE commented 7 years ago

Looking at this again based on what I can see in the gif by @alexcroox

Can anyone help me confirm that this only reproduces if the above is true? I am unsure what is causing this underline and cursor change so I can not check myself.

/cc @rsese

alexcroox commented 7 years ago

I don't believe it's related to hovering over the word, the gif shows 2 examples, the 2nd example (highlighting cmd) I move the cursor away from the word before pressing cmd d

Ben3eeE commented 7 years ago

@alexcroox Yes, but the cursor is hovering and underlining another word, the one above the cmd you selected.

I am just guessing based on what I see in the gif, it might be completely unrelated.

Do you know what is causing the underlining and cursor change?

alexcroox commented 7 years ago

Ah I see, hard to test as although the bug returned for me last week, it's fixed itself again this morning...

The package showing that underline behaviour in the original gif is https://atom.io/packages/highlight-selected (I no longer use it)

rsese commented 7 years ago

The package showing that underline behaviour in the original gif is https://atom.io/packages/highlight-selected (I no longer use it)

Hmm, can you clarify this part @alexcroox? While trying to reproduce, we see that highlight-selected highlights all occurrences of the selected text but the underline in your GIF looks like it only happens on a single word?

@carsondarling would you also be able to share a GIF or screencast of this behavior as well? If so, it would also be helpful if you can have the keybinding resolver open too.

Thanks again for the help :v:

carsondarling commented 7 years ago

I've had a really hard time consistently reproducing this bug, next time it pops up I will absolutely record what's happening.

rsese commented 7 years ago

Sorry one more question @alexcroox - can you share your package list? That might help us narrow things down.

alexcroox commented 7 years ago

@rsese sure https://gist.github.com/alexcroox/924f7aa1ce35f2523ae11b25f302a136

Ben3eeE commented 7 years ago

It was reported in https://github.com/atom/find-and-replace/issues/950 that this happens when you switch projects using project-plus or project-manager because they disable and enable the find-and-replace package when switching projects.

rsese commented 7 years ago

Closing in favor of https://github.com/atom/find-and-replace/issues/950 since we have consistent repro steps there.

Thanks again for everyone's help here and you can subscribe to that issue ☝️ for updates if you'd like.