On 2009-05-08, John Magolske <b79...@gmail.com> wrote: > > I'm running ELinks in a Linux framebuffer console & GNU Screen, and > am looking for a way to adust the width of viewed pages. My console > is set to 128 columns, which can be a bit wide sometimes. I'd like > to view pages in the 80-90 column range. > > In ~/.elinks/elinks.conf setting: > > document.browse.margin_width = 9 > > will reduce the page width to 110 columns, but 9 is the maximum > value that can be set. Is there some way to achieve a narrower page > width? It would also be nice to somehow toggle between full-width > and reduced-width with a key binding. >
If you can compile elinks from source, the following patch (against current git master) would do it. This adds toggle-margin action (default keybind "M") to toggle the margin between 0 and the specified margin_width (which can be up to 100 now). It also adds document.browse.use_margin option to specify whether margins are to be used at startup. There is currently no check for too large of a margin. Strange things may happen if 2*margin > #columns. -Yozo diff --git a/src/config/actions-main.inc b/src/config/actions-main.inc index 21ff838..1f6114f 100644 --- a/src/config/actions-main.inc +++ b/src/config/actions-main.inc @@ -118,6 +118,7 @@ ACTION_(MAIN, "toggle-display-images", TOGGLE_DISPLAY_IMAGES, N__("Toggle displa ACTION_(MAIN, "toggle-display-tables", TOGGLE_DISPLAY_TABLES, N__("Toggle rendering of tables"), 0), ACTION_(MAIN, "toggle-document-colors", TOGGLE_DOCUMENT_COLORS, N__("Toggle usage of document specific colors"), 0), ACTION_(MAIN, "toggle-html-plain", TOGGLE_HTML_PLAIN, N__("Toggle rendering page as HTML / plain text"), 0), +ACTION_(MAIN, "toggle-margin", TOGGLE_MARGIN, N__("Toggle use of margins"), 0), ACTION_(MAIN, "toggle-mouse", TOGGLE_MOUSE, N__("Toggle mouse handling"), 0), ACTION_(MAIN, "toggle-numbered-links", TOGGLE_NUMBERED_LINKS, N__("Toggle displaying of links numbers"), 0), ACTION_(MAIN, "toggle-plain-compress-empty-lines", TOGGLE_PLAIN_COMPRESS_EMPTY_LINES, N__("Toggle plain renderer compression of empty lines"), 0), diff --git a/src/config/kbdbind.c b/src/config/kbdbind.c index 2096a56..bd02886 100644 --- a/src/config/kbdbind.c +++ b/src/config/kbdbind.c @@ -664,6 +664,7 @@ static struct default_kb default_main_keymap[] = { { { 'K', KBD_MOD_CTRL }, ACT_MAIN_COOKIES_LOAD }, { { 'L', KBD_MOD_NONE }, ACT_MAIN_LINK_MENU }, { { 'L', KBD_MOD_CTRL }, ACT_MAIN_REDRAW }, + { { 'M', KBD_MOD_NONE }, ACT_MAIN_TOGGLE_MARGIN }, { { 'N', KBD_MOD_NONE }, ACT_MAIN_FIND_NEXT_BACK }, { { 'N', KBD_MOD_CTRL }, ACT_MAIN_SCROLL_DOWN }, { { 'P', KBD_MOD_CTRL }, ACT_MAIN_SCROLL_UP }, diff --git a/src/config/options.inc b/src/config/options.inc index 4e4b255..998b133 100644 --- a/src/config/options.inc +++ b/src/config/options.inc @@ -447,9 +447,12 @@ static struct option_info config_options_info[] = { "2 automatically starts typeahead searching thru all document\n" " text")), + INIT_OPT_INT("document.browse", N_("Whether to use text margin by default."), + "use_margin", 0, 0, 1, 0, + N_("Whether to use text margin by default.")), INIT_OPT_INT("document.browse", N_("Horizontal text margin"), - "margin_width", 0, 0, 9, 3, + "margin_width", 0, 0, 100, 3, N_("Horizontal text margin.")), INIT_OPT_BOOL("document.browse", N_("Document meta refresh"), diff --git a/src/document/options.c b/src/document/options.c index f00a515..b6dcc54 100644 --- a/src/document/options.c +++ b/src/document/options.c @@ -31,7 +31,7 @@ init_document_options(struct session *ses, struct document_options *doo) doo->hard_assume = get_opt_bool("document.codepage.force_assumed", ses); doo->use_document_colors = get_opt_int("document.colors.use_document_colors", ses); - doo->margin = get_opt_int("document.browse.margin_width", ses); + doo->margin = get_opt_bool("document.browse.use_margin", ses) ? get_opt_int("document.browse.margin_width", ses) : 0; doo->num_links_key = get_opt_int("document.browse.links.number_keys_select_link", ses); doo->meta_link_display = get_opt_int("document.html.link_display", ses); doo->default_form_input_size = get_opt_int("document.browse.forms.input_size", ses); diff --git a/src/viewer/action.c b/src/viewer/action.c index 66e20bb..f629a7e 100644 --- a/src/viewer/action.c +++ b/src/viewer/action.c @@ -608,6 +608,10 @@ do_action(struct session *ses, enum main_action action_id, int verbose) toggle_plain_html(ses, ses->doc_view, 0); break; + case ACT_MAIN_TOGGLE_MARGIN: + toggle_document_option(ses, "document.browse.use_margin"); + break; + case ACT_MAIN_TOGGLE_MOUSE: #ifdef CONFIG_MOUSE toggle_mouse(); _______________________________________________ elinks-users mailing list elinks-users@linuxfromscratch.org http://linuxfromscratch.org/mailman/listinfo/elinks-users