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.

14 comments
Comment actions Permalink

Build 7255, WinXP SP2, jdk1.6.0_02

0
Comment actions Permalink

-1

Sometimes you want to search with the trailing spaces... let's say you want to search in text files which are space delimited...

0
Comment actions Permalink

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 ..

0
Comment actions Permalink

doesn't whole word do this?

0
Comment actions Permalink

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:

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 ..


--
Martin Fuhrer
Fuhrer Engineering AG
http://www.fuhrer.com

0
Comment actions Permalink

Just checked it - same thing: if you have trailing spaces, results will not be found if there are no spaces in the code

0
Comment actions Permalink

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

0
Comment actions Permalink

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/ ?

0
Comment actions Permalink

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 ..

0
Comment actions Permalink

I meant to say "when user types password", of course.

0
Comment actions Permalink

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

0
Comment actions Permalink

Evgeny Goldin wrote:

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.

Yes, I assumed it that way :)
Still leading/trailing spaces are quite important for me.

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/ ?

Nope, that's not me.

0
Comment actions Permalink

Still leading/trailing spaces are quite important for me.


There's another way discussed below - do not touch the spaces but emphasize them somehow. This may satisfy both of us.

Nope, that's not me.

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.

0

Please sign in to leave a comment.