How can I make my view text searchable?


#1

Hi guys, I’ve been using https://github.com/mark-hahn/html-tab as a template for a package I’m developing. So far, it’s been working fine. However, I noticed that doing a search inside the new html view does not work. What would I need to do to enable a user to do a text search inside it?


Find-and-replace results from external search tool
#2

Do you mean do a text search by using the find-and-replace package?


#3

yes, exactly!


#4

In my estimation, you would have to fool the find-and-replace package into thinking that your view was a text editor. This would be a pretty complicated process at this point since the find-and-replace package depends on a number of TextEditor features, such as:

  • Markers and MarkerLayers
  • TextEditor and TextBuffer events
  • TextEditor.scanInBufferRange
  • Selections

This does bring up an interesting point of “what does it mean to be searchable?” Maybe we should abstract that a little more at some point.


#5

Would be useful for a few packages, including the styleguide package (styleguide#5).


#6

Sure, my tablr package would benefit greatly of reusing the find-and-replace UI rather than having to create my own (I had to postpone that feature until I get enough time to tackle it).


#7

It would be great if somebody did a dialog for this that anyone could use. (hint, hint)