SublimeText/CTags — pull request #176 by EdVanDance (2013-12-05 15:51:28+00:00)
Title: Fix navigation (especially for forward declarations)

* Fixes #122.
* Makes #156 obsolete.
* `'^' + pattern[:-5] + '$'` <- How is this supposed to find anything
useful? So `look_from` will be -1 or total crap and `view.find` will
start searching from the beginning or totally off and match forward
declarations first because the `$` (in `find_source` call) was
missing.
* `follow_tag_path` returns `None` if tag path could not be followed,
so we can react properly.
* What we really want is the symbol, not the `ex_command`, BTW the
`ex_command` could be a line number.
* If the `ex_command` is a line number, the `view.line(look_from+1)`
rescued the wrong `view.find(tag.ex_command...`) call. This is not
needed anymore.
* `r"(?:[^_]|$)"` was added to avoid selecting the first part in
e.g.: `type_t type;` when searching for type. Maybe that's not
a perfect solution. Hopefully there is no impact on other languages,
but at least it seems to work for C and Ruby. I can't think of
a language where a symbol can be followed by `_` without being
another symbol.
* `comment` scope had to be removed otherwise e.g.:
`/*bla*/ static type_t type_2;` failed.
* /!\ New behavior: It does not select the whole line any more,
only the searched symbol with the cursor in front of the symbol.
This gives the benefit of highlighting other occurrences automatically
by sublime. Furthermore it is possible to use `find_under_expand`
(`Ctrl+d` by default on Linux and Windows).

My test code:
```c
#include "test.h"

typedef struct {
struct {
int one;
int two;
} embedded;
int one;
int two;
} type_t;

static type_t type;
/*bla*/ static type_t type2;
static int myfunc(void);

int main(int argc, char **argv)
{
type.embedded.one = 1;
type2.one = 1;
return myfunc();
}

static int myfunc(void)
{
return 0;
}

```

To reproduce bugs on current version.
* `Alt+s` -> myfunc (Selects forward declaration instead of the definition)
* Set "debug:" true and see difference for `Alt+s` -> embedded or type_t.
* I know removing the comment scope sucks, but is still better then current behavior because
until now tag path following always failed.

I don't realy like the control flow in `scroll_to_tag`, but I couldn't come up with a better solution because of this
`hook` code at the end.