-
Notifications
You must be signed in to change notification settings - Fork 589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add filetype submenus for new file with template menus #3397
Conversation
Add submenus when there's more than one template per filetype.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAICT this requires files in the templates directory to have a filetype extension, this is not backward compatible and undocumented as currently files with any name are added to the menu, whereas now Geany would crash (see comment).
There are a lot of file formats that are not supported by a Geany filetype, this change would now preclude the user from having templates for them.
Instead, if a file does not have a filetype extension it should be added to the menu top level like those with a count of 1.
add_file_item(fname, menu); | ||
if (ft) | ||
group = &ft_groups[ft->id]; | ||
if (group->count == 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
group
may be NULL if a file in the directory does not have a filetype extension
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized ft
is never NULL in this function. The if (ft)
checks were redundant, removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, ok, filetypes_detect_from_extension()
returns filetype none if it doesn't recognise it.
295e11d
to
db3c381
Compare
ae583e6
to
db3c381
Compare
OK to merge? |
Code ok by inspection (I spend blocks of time away from my dev machine and can't build anything, so can't test ATM). Need to update https://www.geany.org/manual/current/index.html#file-templates to describe using directories. |
Thanks.
Now mentioned filetype submenus. Directories aren't used. |
Yeah, thats what I meant ;-) |
Add submenus when there's more than one template per filetype.
Fixes #3357.
Also put menu items with submenus at the top of the menu, not the bottom.