Ctrl+Shift+F: strip trailing spaces from the query before searching
Hello,
In CtrlShiftF (Find in Path) window the search doesn't work as expected if I have trailing spaces in my query for some reason. This caused me twice to really scratch my head as IDEA was insisting that something wasn't found in the project while I knew it is there..
So I suppose that trailing spaces should always be removed from all kind of queries.
Please sign in to leave a comment.
Build 7255, WinXP SP2, jdk1.6.0_02
-1
Sometimes you want to search with the trailing spaces... let's say you want to search in text files which are space delimited...
I would say it's an extremely rare case - for them there can be a checkbox saying "Do not strip trailing spaces" which would be turned off by default. I mean, how many times did you search for something where trailing space was actually important ? It seems that there will be many more cases where people will have it by mistake and then IDEA mistakenly says "Not found" which may be very confusing ..
doesn't whole word do this?
Well, it happens quite often to me that I want to search with leading
and/or trailing spaces. But I don't remember a single occasion where I
typed a trailing space and forgot about it before hitting 'find'... :)
Evgeny Goldin wrote:
--
Martin Fuhrer
Fuhrer Engineering AG
http://www.fuhrer.com
Just checked it - same thing: if you have trailing spaces, results will not be found if there are no spaces in the code
Rather than manhandle a user's input, perhaps displaying spaces visibly would be preferable? Perhaps something like a square bracket "lying on its back" (open end up) or something of that sort, if subtle and unintrusive enough, would work?
Randall Schulz
No, I didn't deliberately typed Spaces to forget about it right away :)
I've selected something in the code and pressed CtrlShiftF. The selection
grabbed a trailing space somehow as well.
P.S
I'm sorry , Martin, but your name sounded somehow familiar to me and I Googled
for it. Is it you http://www.imdb.com/name/nm0297620/ ?
I thought about something like that as well .. Something like Windows XP saying "You have Caps Lock pressed" when user types a username. How about just coloring spaces with, say, yellow ..
I meant to say "when user types password", of course.
I think the trailing space problem arises quite often when you copy/paste the text to find from an alternate source (web page, IM, mail, you name it...). IntelliJ should mention in bold font under the input field (aligned right) the trailing space count : like
_______________________
sometext______________
2 trailing spaces
Evgeny Goldin wrote:
Yes, I assumed it that way :)
Still leading/trailing spaces are quite important for me.
Nope, that's not me.
There's another way discussed below - do not touch the spaces but emphasize them somehow. This may satisfy both of us.
Hmm .. The guy was born in the same city you're from :) And I've found why it was familiar to me - because of Kari Wuhrer, the actress.
http://www.jetbrains.net/jira/browse/IDEA-14767