Skip to content

Commit 45ad7c9

Browse files
libretroadminLibretroAdmin
authored andcommitted
tools/settings_migrate_group: anchor the strings region when nothing is consumed
A level-variant row without a sublabel consumes no base-language spans, so the insertion anchor fell over an empty span list; such a region anchors at the end of the file instead.
1 parent e057477 commit 45ad7c9

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

tools/settings_migrate_group.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,14 @@ def _cond(g):
421421
out.insert(1, '\n'.join(_pre))
422422
open(os.path.join('settings', DEF), 'w').write('\n'.join(out) + '\n')
423423

424-
first = min(s for s, e in usspan)
425-
for s, e in sorted(usspan, reverse=True): us = us[:s] + us[e:]
424+
if usspan:
425+
first = min(s for s, e in usspan)
426+
for s, e in sorted(usspan, reverse=True): us = us[:s] + us[e:]
427+
else:
428+
# nothing consumed from the base language (a pure-reference
429+
# level-variant row without a sublabel): anchor the region at the
430+
# end of the table, just before the file's closing newline run
431+
first = len(us.rstrip()) + 1
426432
mk_us = lambda b, has_sub: ((' \\\nMSG_HASH(MENU_ENUM_SUBLABEL_##T, sub)' if has_sub else '')
427433
if b.endswith('_LV') else ' \\\nMSG_HASH(MENU_ENUM_LABEL_VALUE_##T, us) \\\nMSG_HASH(MENU_ENUM_SUBLABEL_##T, sub)'
428434
if has_sub else ' \\\nMSG_HASH(MENU_ENUM_LABEL_VALUE_##T, us)')

0 commit comments

Comments
 (0)