cursorless icon indicating copy to clipboard operation
cursorless copied to clipboard

Limit the amount of text used in `scout` and `scout all`

Open SimeonC opened this issue 3 years ago • 1 comments

If a lot of text is selected for scout or scout all it can lock-up talon and your computer for quite a while typing all that text into the find text field. If you select a far too large selection of text you may have to wait a long time before you can do anything again or be forced to crash/quit talon as the text will be inserted into any application/text entry not just cursorless.

I came across this while editing a 1000 line file which had a syntax error in it and due to the invalid code tree-sitter decided that I wanted to search for the entire file, which after about 2 minutes was still not done entering in!

To avoid this kind of situation I think it'd be great if we could limit the amount of text that can be entered in the search fields by 200 characters.

For example; scout ____ with bad syntax selects the entire document, we would only insert the first 200 characters of the document into the search field to avoid the bad edge case mentioned above.

SimeonC avatar Sep 09 '22 00:09 SimeonC

Should be trivial fix; just add truncation step after https://github.com/cursorless-dev/cursorless/blob/4c0676728c0ccfdcc4b6593a4a13ac49fc20a82a/cursorless-talon/src/actions/find.py#L8 and https://github.com/cursorless-dev/cursorless/blob/2ee7ca137e801b922ec020b59c15350818f2d2d0/src/actions/Find.ts#L18

pokey avatar Sep 12 '22 16:09 pokey