<blockquote>
<p>How come it works? e.g. how comes the first tag is always the struct and the second the typedef?</p>
</blockquote>

<p>It works because tags are sorted in the order "name, line_number, ...". tm_workspace_find() will preserve this order so for</p>

<pre><code>typedef struct Foo {
} Foo;
</code></pre>

<p>we can be sure the first Foo is struct and the second is typedef. It won't work just for the single-line ones but I think these won't be very common for structs/unions/etc.</p>

<blockquote>
<p>... Maybe something around the lines of "prefer a tag not on the current line" or something?</p>
</blockquote>

<p>Good point, will have a look at it.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/geany/geany/pull/923#issuecomment-191188630">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ABDrJ1IYr3bbDNGJrqpUKol-9poeYYgjks5ppW4GgaJpZM4HlaDx.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/geany/geany/pull/923#issuecomment-191188630"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>