[Github-comments] [geany] Don't show the goto popup for typedef synonyms (#923)

Colomban Wendling notifications at xxxxx
Fri Mar 4 18:31:35 UTC 2016


> @@ -2094,6 +2095,30 @@ static gboolean goto_tag(const gchar *name, gboolean definition)
>  			g_ptr_array_add(workspace_tags, tmtag);
>  	}
>  
> +	/* If there are typedefs of e.g. a struct such as "typedef struct Foo {} Foo;",
> +	 * keep just one of the names in the list - when the cursor is on the struct
> +	 * name, keep the typename, otherwise keep the struct name. Also remove tags
> +	 * that are at the cursor location. */
> +	last_tag = NULL;
> +	filtered_tags = g_ptr_array_new();
> +	foreach_ptr_array(tmtag, i, workspace_tags)
> +	{
> +		if (last_tag != NULL && last_tag->file == tmtag->file &&
> +			last_tag->type != tm_tag_typedef_t && tmtag->type == tm_tag_typedef_t)
> +		{
> +			if (last_tag->line == current_line)
> +				/* if cursor on struct, replace struct with the typedef */
> +				filtered_tags->pdata[filtered_tags->len-1] = tmtag;

crashes if the typedef is first, which seems to happen in my second example (simple one with `Bcd`).
Just adding a `filtered_tags->len > 0` to the big conditional is enough, and I guess is the right thing to do.

---
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/923/files#r55068747
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20160304/7970dbab/attachment.html>


More information about the Github-comments mailing list