ameyp / CscopeSublime

A Cscope plugin for Sublime Text 2 and 3
89 stars 37 forks source link

Double click or enter key to navigate results #11

Closed vanrijn closed 11 years ago

vanrijn commented 11 years ago

This addresses https://github.com/ameyp/CscopeSublime/issues/7

It changes the CscopeVisiter class inheritance from sublime_plugin.EventListener to sublime_plugin.TextCommand. This allows us to define key and mouse events in -mousemap and -keymap files. I've tested this in OS X, but I believe it should work correctly in Linux and Windows too.

vanrijn commented 11 years ago

Oh, also, FWIW, according to http://www.sublimetext.com/forum/viewtopic.php?f=6&t=3311 jps says "Unfortunately, mousemap bindings don't support contexts at the moment." So CscopeVisiter will be hit every time you double-click in a ST2 view. Thankfully, CscopeVisiter already had the logic to do absolutely nothing unless the view being acted on is the right syntax/scope. Just thought I'd mention this because it surprised me when I discovered it. Talked with FichteFoll in #sublimetext2 IRC and he confirmed that this is the case.

ameyp commented 11 years ago

Do you know what the "context": [{"key": "selector", "operand": "text.find-in-files"}] line does? I understood the rest of your changes, but I'm having trouble figuring out what that line is for, particularly the "text.find-in-files" part.

Edit - Oh, I see, it's the context for the syntax file.

vanrijn commented 11 years ago

Yeah, sorry, should have explained. The scope or context of the cscope results buffer is text:find-in-files. You can see this by pressing Cmd-Option-P while in the Cscope buffer. It will show this in the bottom status area.

ameyp commented 11 years ago

We might have a problem here. Double-clicking no longer seems to select the word under the cursor. @vanrijn Can you check if you're seeing the same issue at your end?

ameyp commented 11 years ago

Nevermind, should be fixed with https://github.com/ameyp/CscopeSublime/commit/99094c60f567189345eeba51e20bb5757cba75ce