Home Download Buy Blog Forum Support

Request: Mac: Use selection for find

Request: Mac: Use selection for find

Postby asomorjai on Sat Apr 21, 2012 8:16 am

Hi folks,

When I'm building our app in the Terminal, or use Xcode or BBEdit, the "Use selection for Find" (Command-E) works transparently. This is not the case with Sublime, I have to copy and paste the text I'd like to search for into the Find field.

Could this be added to the next build, is there a solution already that I'm not aware of?

Thanks,

Akos
asomorjai
 
Posts: 10
Joined: Fri Apr 13, 2012 12:15 pm

Re: Request: Mac: Use selection for find

Postby phillip.koebbe on Sat Apr 21, 2012 12:12 pm

If you are talking about selecting something in the current view (in ST2), then opening the Find panel and having what you selected in the Find dialog automatically, you can accomplish that by putting

Code: Select all
    // If true, the selected text will be copied into the find panel when it's
    // shown.
    // On OS X, this value is overridden in the platform specific settings, so
    // you'll need to place this line in your user settings to override it.
    "find_selected_text": true


in your User preferences (Sublime Text 2 -> Preferences -> Settings-User).

If you are talking about copying something outside of ST2 and having it populate the Find dialog (via system copy buffer), I don't know if that's possible.
-- Phillip

Code: Select all
while self.living? do
    mistake = Mistake.new
    self.learn_from!(mistake) unless mistake.fatal?
end
phillip.koebbe
 
Posts: 208
Joined: Tue Dec 20, 2011 4:58 pm

Re: Request: Mac: Use selection for find

Postby jps on Sat Apr 21, 2012 2:57 pm

Cmd+E uses the system find pasteboard in the current series of dev builds
jps
Site Admin
 
Posts: 3058
Joined: Wed Mar 19, 2008 12:33 pm

Re: Request: Mac: Use selection for find

Postby phillip.koebbe on Sat Apr 21, 2012 3:21 pm

jps wrote:Cmd+E uses the system find pasteboard in the current series of dev builds


Build 2194.

When you say "system find pasteboard", do you mean that if I search for a string in some other application and then return to ST2 and press CMD-E, it should search for the same term I searched for in the other application? I just experimented with Chrome and Pages, but it didn't work.

Is that the expected behavior or am I misunderstanding?
-- Phillip

Code: Select all
while self.living? do
    mistake = Mistake.new
    self.learn_from!(mistake) unless mistake.fatal?
end
phillip.koebbe
 
Posts: 208
Joined: Tue Dec 20, 2011 4:58 pm

Re: Request: Mac: Use selection for find

Postby jps on Sun Apr 22, 2012 8:03 am

No, Cmd+E copies the selected text to the system pasteboard. Cmd+G finds the next occurrence of the text on the system pasteboard.
jps
Site Admin
 
Posts: 3058
Joined: Wed Mar 19, 2008 12:33 pm

Re: Request: Mac: Use selection for find

Postby asomorjai on Mon Apr 23, 2012 1:45 pm

jps wrote:Cmd+E uses the system find pasteboard in the current series of dev builds


Thanks, that's the answer I was looking for!

May I have access to the dev builds some way or another?
--->Oh me, oh my, I've found it.

Thanks, Akos
asomorjai
 
Posts: 10
Joined: Fri Apr 13, 2012 12:15 pm

Re: Request: Mac: Use selection for find

Postby phillip.koebbe on Mon Apr 23, 2012 7:09 pm

Please forgive me if I'm being dense, but I'm trying to wrap my head around how this system find buffer is supposed to work and I'm at least a little bewildered.

I'm bouncing back and forth between ST2 (2194) and Chrome (18) on Mac OS X 10.7.3. If I CMD-F (yes, that's an F, not an E) in ST2 and type some search string, that same search string winds up in Chrome's find (CMD-F) dialog automatically. If I change it in Chrome, it gets changed in ST2. Is this how it is supposed to work? If so, is there a way to disable it? I do not want my find dialog changing automatically on me in ST2.
-- Phillip

Code: Select all
while self.living? do
    mistake = Mistake.new
    self.learn_from!(mistake) unless mistake.fatal?
end
phillip.koebbe
 
Posts: 208
Joined: Tue Dec 20, 2011 4:58 pm

Re: Request: Mac: Use selection for find

Postby jps on Tue Apr 24, 2012 5:47 am

Your example is indeed the way it's supposed to work: all applications on OS X work this way. There's no setting to disable this within Sublime Text, and even if one was added, it'd seem futile: all your other applications would still use the shared system find pasteboard.

An example of making use of the find pasteboard: You see a function name you'd like to find some documentation on, so you select the function name, press Cmd+E to copy the function name to the find pasteboard, switch to another application with the documentation, and press Cmd+G to find the next occurrence of the string.
jps
Site Admin
 
Posts: 3058
Joined: Wed Mar 19, 2008 12:33 pm

Re: Request: Mac: Use selection for find

Postby phillip.koebbe on Tue Apr 24, 2012 12:23 pm

Thanks for the reply and explanation, Jon. What has me scratching my head is I'm talking about CMD-F, not CMD-E. I've been using a Mac for 5 years and just hadn't noticed it before, so either it's something new(ish) or I just won't encounter it often enough for it to be a real problem. I did some searching and there were complaints about this with Firefox about a year ago [1], but that was related to OS X 10.5, and appeared to be resolved in 10.6. I've done some quick testing with Safari and TextEdit, and it appears that this is something Apple has done at the OS level as they both exhibit the global behavior in 10.7. I can't say that I like it, at least not yet. There are many times that I will switch away from one application and do something completely unrelated in another, and if I search in that other application, I don't want my find dialog (or anything else!) changed in the first application without me explicitly initiating that change.

Thanks for being patient with me on this. Much appreciated.

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=654125

EDIT: Another thread that suggests this is something Apple implemented at the OS level and there's nothing we can do about it (it also suggests there are other people who dislike this functionality, so I'm not alone ... yay!):

http://www.cocoabuilder.com/archive/xco ... -apps.html
-- Phillip

Code: Select all
while self.living? do
    mistake = Mistake.new
    self.learn_from!(mistake) unless mistake.fatal?
end
phillip.koebbe
 
Posts: 208
Joined: Tue Dec 20, 2011 4:58 pm


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot] and 23 guests