Browser search in code mirror editor

Hi, Have a question about the solution suggested for the issue: browser search in code mirror searches the content visible in view port only. I referred to the link for the same: https://github.com/codemirror/CodeMirror/issues/221 and the page suggests setting the property ‘viewportMargin’ to infinity, however that will lead to performance issue. The same page also suggests the solution in https://codemirror.net/2/demo/search.html. I looked into this demo code and I have the below questions:

  1. I dont see the property ‘viewportMargin’ set in the demo code, however on inspecting in dev tools, i see that dom nodes are generated for the entire code editor content upfront, probably why the browser search finds all occurrences of the search string throughout the content. - How does this work if the ‘viewportMargin’ property is not set in the code? Is this demo using any other solution to get this working?
  2. Also I see that the search/searchcursor/dialog js/css files referenced in this demo code is from lib/util, while I can only find the same files inside the addon folder on my codemirror download (I have checked in code mirror version 5.49.2 and the latest version) - Can you please clarify if the specific search related js/css files referenced by the demo should be used for the solution to work? if yes, from where to obtain the files? I tried copy, pasting the content of the files from the demo code, however the solution doesnt seem to work since not all dom nodes are generated upfront in my case.

If the document is small enough, it’ll be rendered entirely.

Not sure what you mean here. There isn’t a single occurrence of lib/util in that file.

Thanks for your response, so there is no way, other than setting the property ‘viewPortMargin’ to infinity, to make the browser search find all occurrences?

Nope.

 

Thanks for confirming