mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Introduce session- (tab-)specific options
Introduce session-specific options for those options that have toggle-... actions.
This commit is contained in:
parent
fd22173b29
commit
fa12b10e26
@ -252,7 +252,10 @@ get_opt_(
|
|||||||
{
|
{
|
||||||
struct option *opt = NULL;
|
struct option *opt = NULL;
|
||||||
|
|
||||||
/* TODO: Look for a session-specific option. */
|
/* If given a session and the option is shadowed in that session's
|
||||||
|
* options tree, return the shadow. */
|
||||||
|
if (ses && ses->option)
|
||||||
|
opt = get_opt_rec_real(ses->option, name);
|
||||||
|
|
||||||
/* TODO: Look for a domain-specific option. */
|
/* TODO: Look for a domain-specific option. */
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ init_document_options(struct session *ses, struct document_options *doo)
|
|||||||
doo->assume_cp = get_opt_codepage("document.codepage.assume", NULL);
|
doo->assume_cp = get_opt_codepage("document.codepage.assume", NULL);
|
||||||
doo->hard_assume = get_opt_bool("document.codepage.force_assumed", NULL);
|
doo->hard_assume = get_opt_bool("document.codepage.force_assumed", NULL);
|
||||||
|
|
||||||
doo->use_document_colors = get_opt_int("document.colors.use_document_colors", NULL);
|
doo->use_document_colors = get_opt_int("document.colors.use_document_colors", ses);
|
||||||
doo->margin = get_opt_int("document.browse.margin_width", NULL);
|
doo->margin = get_opt_int("document.browse.margin_width", NULL);
|
||||||
doo->num_links_key = get_opt_int("document.browse.links.number_keys_select_link", NULL);
|
doo->num_links_key = get_opt_int("document.browse.links.number_keys_select_link", NULL);
|
||||||
doo->meta_link_display = get_opt_int("document.html.link_display", NULL);
|
doo->meta_link_display = get_opt_int("document.html.link_display", NULL);
|
||||||
@ -57,16 +57,16 @@ init_document_options(struct session *ses, struct document_options *doo)
|
|||||||
|
|
||||||
/* Boolean options. */
|
/* Boolean options. */
|
||||||
#ifdef CONFIG_CSS
|
#ifdef CONFIG_CSS
|
||||||
doo->css_enable = get_opt_bool("document.css.enable", NULL);
|
doo->css_enable = get_opt_bool("document.css.enable", ses);
|
||||||
doo->css_import = get_opt_bool("document.css.import", NULL);
|
doo->css_import = get_opt_bool("document.css.import", NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
doo->plain_display_links = get_opt_bool("document.plain.display_links", NULL);
|
doo->plain_display_links = get_opt_bool("document.plain.display_links", NULL);
|
||||||
doo->plain_compress_empty_lines = get_opt_bool("document.plain.compress_empty_lines", NULL);
|
doo->plain_compress_empty_lines = get_opt_bool("document.plain.compress_empty_lines", ses);
|
||||||
doo->underline_links = get_opt_bool("document.html.underline_links", NULL);
|
doo->underline_links = get_opt_bool("document.html.underline_links", NULL);
|
||||||
doo->wrap_nbsp = get_opt_bool("document.html.wrap_nbsp", NULL);
|
doo->wrap_nbsp = get_opt_bool("document.html.wrap_nbsp", NULL);
|
||||||
doo->use_tabindex = get_opt_bool("document.browse.links.use_tabindex", NULL);
|
doo->use_tabindex = get_opt_bool("document.browse.links.use_tabindex", NULL);
|
||||||
doo->links_numbering = get_opt_bool("document.browse.links.numbering", NULL);
|
doo->links_numbering = get_opt_bool("document.browse.links.numbering", ses);
|
||||||
|
|
||||||
doo->active_link.color = get_opt_bool("document.browse.links.active_link.enable_color", NULL);
|
doo->active_link.color = get_opt_bool("document.browse.links.active_link.enable_color", NULL);
|
||||||
doo->active_link.invert = get_opt_bool("document.browse.links.active_link.invert", NULL);
|
doo->active_link.invert = get_opt_bool("document.browse.links.active_link.invert", NULL);
|
||||||
@ -74,9 +74,9 @@ init_document_options(struct session *ses, struct document_options *doo)
|
|||||||
doo->active_link.bold = get_opt_bool("document.browse.links.active_link.bold", NULL);
|
doo->active_link.bold = get_opt_bool("document.browse.links.active_link.bold", NULL);
|
||||||
|
|
||||||
doo->table_order = get_opt_bool("document.browse.table_move_order", NULL);
|
doo->table_order = get_opt_bool("document.browse.table_move_order", NULL);
|
||||||
doo->tables = get_opt_bool("document.html.display_tables", NULL);
|
doo->tables = get_opt_bool("document.html.display_tables", ses);
|
||||||
doo->frames = get_opt_bool("document.html.display_frames", NULL);
|
doo->frames = get_opt_bool("document.html.display_frames", NULL);
|
||||||
doo->images = get_opt_bool("document.browse.images.show_as_links", NULL);
|
doo->images = get_opt_bool("document.browse.images.show_as_links", ses);
|
||||||
doo->display_subs = get_opt_bool("document.html.display_subs", NULL);
|
doo->display_subs = get_opt_bool("document.html.display_subs", NULL);
|
||||||
doo->display_sups = get_opt_bool("document.html.display_sups", NULL);
|
doo->display_sups = get_opt_bool("document.html.display_sups", NULL);
|
||||||
|
|
||||||
@ -135,8 +135,13 @@ toggle_document_option(struct session *ses, unsigned char *option_name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
option = get_opt_rec(config_options, option_name);
|
option = get_opt_rec(config_options, option_name);
|
||||||
|
assert(option);
|
||||||
|
if_assert_failed return;
|
||||||
|
|
||||||
|
if (ses->option)
|
||||||
|
option = get_option_shadow(option, config_options, ses->option);
|
||||||
|
if (!option) return;
|
||||||
|
|
||||||
/* TODO: toggle per document. --Zas */
|
|
||||||
toggle_option(ses, option);
|
toggle_option(ses, option);
|
||||||
|
|
||||||
draw_formatted(ses, 1);
|
draw_formatted(ses, 1);
|
||||||
|
@ -865,6 +865,8 @@ init_session(struct session *base_session, struct terminal *term,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ses->option = copy_option(config_options,
|
||||||
|
CO_SHALLOW | CO_NO_LISTBOX_ITEM);
|
||||||
create_history(&ses->history);
|
create_history(&ses->history);
|
||||||
init_list(ses->scrn_frames);
|
init_list(ses->scrn_frames);
|
||||||
init_list(ses->more_files);
|
init_list(ses->more_files);
|
||||||
@ -1175,6 +1177,10 @@ destroy_session(struct session *ses)
|
|||||||
#ifdef CONFIG_ECMASCRIPT
|
#ifdef CONFIG_ECMASCRIPT
|
||||||
mem_free_if(ses->status.window_status);
|
mem_free_if(ses->status.window_status);
|
||||||
#endif
|
#endif
|
||||||
|
if (ses->option) {
|
||||||
|
delete_option(ses->option);
|
||||||
|
ses->option = NULL;
|
||||||
|
}
|
||||||
del_from_list(ses);
|
del_from_list(ses);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,6 +138,10 @@ struct session {
|
|||||||
|
|
||||||
struct window *tab;
|
struct window *tab;
|
||||||
|
|
||||||
|
/* Session-specific options */
|
||||||
|
|
||||||
|
struct option *option;
|
||||||
|
|
||||||
|
|
||||||
/** @} @name Browsing history
|
/** @} @name Browsing history
|
||||||
* @{ */
|
* @{ */
|
||||||
|
Loading…
Reference in New Issue
Block a user