Find (and replace) does not work - what am I doing wrong?


#1

The screenshot says it all. I select some text, try to “find” a string, and Atom only finds one example. It’s not even in the selected text! I can’t find anyone else with this problem, so it must be doing something wrong. Please help!


#2

Hi,

Do you have the correct encoding set for the file? Atom defaults to utf-8. If this is a utf-16 file which seems to be common for game configuration files then searching wont work as expected.

You can change the encoding from the encoding selector which is available using encoding-selector:show bound to ctrl-shift-u by default or by clicking on the encoding in the status bar.


#3

Thanks for the reply. I’m pretty sure that it’s utf-8. I should have added that when I first load Atom, the first search works. But some details of the first search seem to be remembered in later searches.

I just found a workaround. If I click a different tab, then return to the tab I’m working on, then search works correctly. I don’t know if that helps with tracing the problem.


#4

Hey,

  • What version of Atom are you using?
  • Do you see any errors in the developer tools console when the search is failing?

#5

It reports version 1.20.1 ia32 and says "up to date ". Here is another screenshot, with developer tools open.


This is what I did:

  1. Opened Atom, used find, got the correct result (9 results).
  2. Selected a different section, clicked “find” and it still reported the previous 9 results. Took the screenshot.
  3. After taking the screenshot I switched tabs again, and on return the correct result was shown.

#6

Hi @tolworthy,

There is an error in the developer tools. Can you click on the little red icon in the upper right corner to see what the error says?


#7

Thanks for spotting that! I’m new at this, as you can tell. Hope this means something to you:


#8

As text:
:116489 IntersectionObserver.observe(target): target element is not a descendant of root.
TreeView @ :116489
util.js:1022 Uncaught (in promise) Error: spawn UNKNOWN
at exports._errnoException (util.js:1022:11)
at ChildProcess.spawn (internal/child_process.js:313:11)
at exports.spawn (child_process.js:399:9)
at Object.exports.execFile (child_process.js:160:15)
at Object.module.(anonymous function) [as execFile] (ELECTRON_ASAR.js:200:20)
at C:\Users\Chris\AppData\Local\atom\app-1.19.7\resources\app\node_modules\dugite\build\lib\git-process.js:65:52
at Function.exec (C:\Users\Chris\AppData\Local\atom\app-1.19.7\resources\app\node_modules\dugite\build\lib\git-process.js:48:16)
at Proxy.executeGitCommand (C:\Users\Chris\AppData\Local\atom\app-1.20.1\resources\app\node_modules\github\lib\git-shell-out-strategy.js:383:54)
at C:\Users\Chris\AppData\Local\atom\app-1.20.1\resources\app\node_modules\github\lib\git-shell-out-strategy.js:253:50
at Generator.next ()
at step (C:\Users\Chris\AppData\Local\atom\app-1.20.1\resources\app\node_modules\github\lib\git-shell-out-strategy.js:88:197)
at C:\Users\Chris\AppData\Local\atom\app-1.20.1\resources\app\node_modules\github\lib\git-shell-out-strategy.js:88:443
at C:\Users\Chris\AppData\Local\atom\app-1.20.1\resources\app\node_modules\github\lib\git-shell-out-strategy.js:88:105
at Promise (C:\Users\Chris\AppData\Local\atom\app-1.20.1\resources\app\node_modules\github\lib\git-shell-out-strategy.js:350:32)
at C:\Users\Chris\AppData\Local\atom\app-1.20.1\resources\app\node_modules\github\lib\git-shell-out-strategy.js:251:22
at Generator.next ()
at step (C:\Users\Chris\AppData\Local\atom\app-1.20.1\resources\app\node_modules\github\lib\git-shell-out-strategy.js:88:197)
at C:\Users\Chris\AppData\Local\atom\app-1.20.1\resources\app\node_modules\github\lib\git-shell-out-strategy.js:88:443
at C:\Users\Chris\AppData\Local\atom\app-1.20.1\resources\app\node_modules\github\lib\git-shell-out-strategy.js:88:105
at C:\Users\Chris\AppData\Local\atom\app-1.20.1\resources\app\node_modules\github\lib\async-queue.js:26:44
at Generator.next ()
at step (C:\Users\Chris\AppData\Local\atom\app-1.20.1\resources\app\node_modules\github\lib\async-queue.js:7:197)
at C:\Users\Chris\AppData\Local\atom\app-1.20.1\resources\app\node_modules\github\lib\async-queue.js:7:443
at C:\Users\Chris\AppData\Local\atom\app-1.20.1\resources\app\node_modules\github\lib\async-queue.js:7:105
at Task.execute (C:\Users\Chris\AppData\Local\atom\app-1.20.1\resources\app\node_modules\github\lib\async-queue.js:31:13)
at C:\Users\Chris\AppData\Local\atom\app-1.20.1\resources\app\node_modules\github\lib\async-queue.js:96:26
at Generator.next ()
at step (C:\Users\Chris\AppData\Local\atom\app-1.20.1\resources\app\node_modules\github\lib\async-queue.js:7:197)
at C:\Users\Chris\AppData\Local\atom\app-1.20.1\resources\app\node_modules\github\lib\async-queue.js:7:443
at C:\Users\Chris\AppData\Local\atom\app-1.20.1\resources\app\node_modules\github\lib\async-queue.js:7:105


#9

Hi,

Looks like this error is from the GitHub package and it seems to be an issue with the 32-bit Windows version. This is unrelevant to the search issue you are having. https://github.com/atom/github/issues/986

I think the issue you are having is this one: https://github.com/atom/find-and-replace/issues/677 seems like there is a bug with find in selection.


#10

Interesting. So as people tend to migrate to 64 bit it shouldn’t be a high priority. I accept that bugs are fixed by volunteers, so I can live with that.

It’s not even a huge problem for me any more - I only realised this morning that I could just click “tab -tab” before searching, to solve the problem. I will happily put up with that for Atom’s other benefits. It’s still faster than my paid-for editor, and Atom doesn’t nag me to upgrade.

Thanks again for your help.