tagtree: "By First Letter" : fix numerical entry + add a "Special character" entry

- The "Special character" entry will show all special characters (non numerical + non letters)
- The numerical entry was bug, and could show some special characters from the ASCII table. It is now fixed.

Change-Id: I001fb322fab81918996e15e4d0ca6b7c9e5160af
This commit is contained in:
Paul Sauro 2025-02-07 14:39:49 +01:00 committed by William Wilgus
parent 2cf6a443b1
commit d5fc0e4cb3
5 changed files with 56 additions and 4 deletions

View file

@ -479,6 +479,9 @@ static int get_clause(int *condition)
CLAUSE('@', '^', clause_begins_oneof),
CLAUSE('@', '$', clause_ends_oneof),
CLAUSE('@', ' ', clause_oneof),
CLAUSE('*', '^', clause_not_begins_oneof),
CLAUSE('*', '$', clause_not_ends_oneof),
CLAUSE('!', '@', clause_not_oneof),
CLAUSE(0, 0, 0) /* sentinel */
};
@ -1121,9 +1124,9 @@ static void build_firstletter_menu(char *buf, size_t bufsz)
const char * const showsub = /* album subitem for canonicalartist */
((strcasestr(subitem, "artist") == NULL) ? "title" : "album -> title");
/* Numeric ex: "Numeric" -> album ? album < "A" -> title = "fmt_title" */
snprintf(buf, bufsz, fmt,
str(LANG_DISPLAY_NUMERIC), subitem, subitem,'<', 'A', showsub);
const char * fmt_numeric ="\"%s\"-> %s ? %s @^ \"0|1|2|3|4|5|6|7|8|9\" -> %s =\"fmt_title\"";
snprintf(buf, bufsz, fmt_numeric,
str(LANG_DISPLAY_NUMERIC), subitem, subitem, showsub);
if (!alloc_menu_parse_buf(buf, menu_byfirstletter))
{
@ -1140,6 +1143,16 @@ static void build_firstletter_menu(char *buf, size_t bufsz)
return;
}
}
const char * fmt_special ="\"%s\"-> %s ? %s *^ \"0|1|2|3|4|5|6|7|8|9\" & "\
"%s *^ \"A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z\" -> %s =\"fmt_title\"";
snprintf(buf, bufsz, fmt_special,
str(LANG_DISPLAY_SPECIAL_CHARACTER), subitem, subitem, subitem, showsub);
if (!alloc_menu_parse_buf(buf, menu_byfirstletter))
{
return;
}
}
static bool parse_menu(const char *filename);