mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
charset_list: Map the "System" codepage to the underlying one.
If LC_CTYPE=fi_FI.ISO-8859-15, and terminal.*.charset = System, then the charset menu will select ISO 8859-15 by default.
This commit is contained in:
parent
9f64320a3b
commit
22413166b0
@ -48,7 +48,9 @@ charset_list(struct terminal *term, void *xxx, void *ses_)
|
|||||||
{
|
{
|
||||||
struct session *ses = ses_;
|
struct session *ses = ses_;
|
||||||
int i, items;
|
int i, items;
|
||||||
int sel = int_max(0, get_opt_codepage_tree(term->spec, "charset"));
|
int sel = 0;
|
||||||
|
const unsigned char *const sel_mime = get_cp_mime_name(
|
||||||
|
get_opt_codepage_tree(term->spec, "charset"));
|
||||||
struct menu_item *mi = new_menu(FREE_LIST);
|
struct menu_item *mi = new_menu(FREE_LIST);
|
||||||
|
|
||||||
if (!mi) return;
|
if (!mi) return;
|
||||||
@ -62,16 +64,16 @@ charset_list(struct terminal *term, void *xxx, void *ses_)
|
|||||||
if (is_cp_utf8(i)) continue;
|
if (is_cp_utf8(i)) continue;
|
||||||
#endif /* CONFIG_UTF8 */
|
#endif /* CONFIG_UTF8 */
|
||||||
|
|
||||||
|
/* Map the "System" codepage to the underlying one.
|
||||||
|
* A pointer comparison might suffice here but this
|
||||||
|
* code is not time-critical. */
|
||||||
|
if (strcmp(sel_mime, get_cp_mime_name(i)) == 0)
|
||||||
|
sel = items;
|
||||||
items++;
|
items++;
|
||||||
add_to_menu(&mi, name, NULL, ACT_MAIN_NONE,
|
add_to_menu(&mi, name, NULL, ACT_MAIN_NONE,
|
||||||
display_codepage, get_cp_config_name(i), 0);
|
display_codepage, get_cp_config_name(i), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Special codepages are not in the menu and it may cause assertion
|
|
||||||
* failures later if the selected item is out of bound. */
|
|
||||||
if (sel >= items)
|
|
||||||
sel = 0;
|
|
||||||
|
|
||||||
do_menu_selected(term, mi, ses, sel, 0);
|
do_menu_selected(term, mi, ses, sel, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user