> @@ -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;

```diff
diff --git a/src/symbols.c b/src/symbols.c
index 56e2982..e8d6fc9 100644
--- a/src/symbols.c
+++ b/src/symbols.c
@@ -2104,7 +2104,8 @@ static gboolean goto_tag(const gchar *name, gboolean 
definition)
     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)
+            last_tag->type != tm_tag_typedef_t && tmtag->type == 
tm_tag_typedef_t &&
+            filtered_tags->len > 0)
         {
             if (last_tag->line == current_line)
                 /* if cursor on struct, replace struct with the typedef */
```

---
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/923/files#r55068886

Reply via email to