Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

search query should not strip spaces #300

Open
dwelle opened this issue May 10, 2018 · 4 comments
Open

search query should not strip spaces #300

dwelle opened this issue May 10, 2018 · 4 comments
Labels

Comments

@dwelle
Copy link

dwelle commented May 10, 2018

Spaces are significant. Right now the workaround is to use regexp search and replace spaces with \s, which is not ideal since it also matches EOL.

Narrow 0.65.0, Win7, Atom 1.26.1

@t9md
Copy link
Owner

t9md commented Jun 11, 2018

Yes, that is limitation, you cannot search space surrounded keyword.
Current query spec is here https://github.com/t9md/atom-narrow/wiki/Query.

Using space as query keyword separator, I cannot keep bare white-space intact.

My suggestion is use \s. if it's not sufficient, try [\s].
OK, doesn't work to exclude matching to EOL. I admit it is a limitation.

@t9md t9md added not-resolved limitation No fix is planned labels Jun 11, 2018
@dwelle
Copy link
Author

dwelle commented Jun 11, 2018

Maybe having an option so we can toggle behavior to tokenize AND operator on & instead of SPACE?

@t9md
Copy link
Owner

t9md commented Jun 11, 2018

That's one idea, then we have to escape & when we want to search literal &.

Another idea I implemented experimentally but removed is to "set query end manually by special command" such as narrow-ui:set-query-end.
Let's say you have foo bar .| buz text at prompt line and | here is your cursor(not literal pipe char).
Then you execute narrow-ui:set-query-end via some short-cut.
Then foo bar . is passed to ag as one query. then remaining buz is used to filter ag's output as always.

What do you think of this idea?

@dwelle
Copy link
Author

dwelle commented Jun 11, 2018

Why not.. If I understand it correctly, to search for foo bar baz via AND, you'd place multiple cursors: foo|bar|buz and run narrow-ui:set-query-end?

Now, it depends on how much you use what. Can be a drag if user wants to use both AND operator and space in their regexes, on regular basis.

For me, I personally didn't know that foo bar baz does AND-search. I just quite heavily use space in my regex searches. But since learning about the AND-search behavior, I can imagine I'll use both AND-search and space-in-regexes, quite regularly -- and then narrow-ui:set-query-end might become a bottleneck.

IMO, using & for AND-search and having to escape \& for literal & char isn't that crazy since people (only me?) don't to too many searches containing & char.

Either way, I'm not opposed to any solution that allows my beloved space to be added to regexes :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants