SlickEdit Community
SlickEdit Product Discussion => SlickEdit® => Topic started by: evanratt on October 15, 2007, 04:07:53 PM
-
Hey all,
I feel like I must be missing something, but I've searched the help docs and the commands in the keybinding list without success. I really, really, really like the Find References feature (did I mention I like it?). However, as a keyboard-phile, I don't like having to use the mouse for any functionality. I currently have find-refs just bring up the list of references and not jump to the first one. I have keys bound for next-ref and prev-ref, which lets me navigate that list and see each reference in the preview window. However, if I find the reference I actually want to work with, I can't find a direct command to open it in my main editing window. The best I currently have is to use next-ref to find the ref I want, then I use prev-ref to go back one, and then I use my 'find-next' bound key to jump to the next ref in the main window. I would really like a find-current command to jump to the currently selected reference, rather than this slightly convoluted process. Is there a command to do that that I'm just not seeing?
Thanks,
Evan
-
Hi Evan,
there is curr. no such command but I see your point. Thanks to the good work of the Slickteam almost everything needed was already there. So it boils down to simple patch to the tagrefs.e module as follows or you could install the UNOFFICIAL hotfix attached containing exactly the patch below. (see VSLICKCONFIG/hotfixes if you want to check changed module after installation.
patch #1: tagrefs.e - next_prev_ref_in_tree() [line 1533]: (SE v12.0.3)
int status = 0;
if (direction > 0) {
status=_TreeDown();
} else if (direction < 0) { // HS2-CHG: expl. check for neg. dir to support/allow direction == 0
status=_TreeUp();
}
patch #2: tagrefs.e - prev_ref() [line 1609]: (SE v12.0.3)
// HS2-ADD: open curr. active ref in editor
_command int curr_ref(boolean preview_only=false,boolean quiet=false) name_info(','VSARG2_EDITORCTL|VSARG2_READ_ONLY|VSARG2_REQUIRES_MDI_EDITORCTL|VSARG2_REQUIRES_TAGGING|VSARG2_REQUIRES_EDITORCTL)
{
return next_prev_ref(0,preview_only,quiet);
}
Finally bind the new 'curr-ref' command to a key.
Edit: Catched the corner case where just a file node but no ref. is selected. Proceed to the next ref (1st ref of the selected file). Hotfix updated.
tagrefs.e - next_prev_ref_in_tree() [line 1551]: (v12.0.3)
else if (_TreeGetDepth(index)==1 && show_children==1) {
// HS2-ADD: if a file node is selected AND direction is 0 we've to change/fix direction
// to avoid lifelocking -> set to 1 to proceeed to the next ref. contained in the selected file
if (direction == 0) direction = 1;
continue;
}
Have fun,
HS2
@SlickTeam: Is this an allowed/possible way to post stuff like that or can this cause conflicts to the official hotfix mechanism ?
-
Thanks hs2, that looks like just what I needed. After spending a good bit of time trying to figure out if the feature was already there, I didn't have the energy to look into the macro code - I didn't even know what file to look in.
Edit: Yep, I added a macro that checks if the refs window is active, and if so pushes a bookmark and then jumps to the current reference. Fits into my workflow really well and I'm already finding it really helpful. You made me a very happy camper today.
-
Hi Evan, I'm glad that it works for you !
I'm using a similar wrapper now following your idea for bookmark support and toolbar check resp. auto activation.
Just for completeness reasons:
_command void hs2_goto_curr_ref ( boolean forceActive = false ) name_info(','VSARG2_REQUIRES_EDITORCTL|VSARG2_READ_ONLY)
{
if ( !forceActive )
{
wid := _tbGetWid ("_tbtagrefs_form");
if ( !wid || !(_tbIsWidActive(wid) && wid.p_enabled) )
{
message ("References toolbar not active.");
return;
}
}
push_bookmark ();
if ( !curr_ref( false, true ) )
{
if ( forceActive )
{
activate_references();
cursor_data();
}
center_line ();
}
else
{
// undo bookmark
pop_bookmark ();
message ("No (more) references.");
}
}
HS2