diff options
author | Daniel Bainton <dpb@driftaway.org> | 2009-03-30 01:39:10 +0300 |
---|---|---|
committer | Daniel Bainton <dpb@driftaway.org> | 2009-03-30 01:39:10 +0300 |
commit | 187a53c4cae837585dd4254329e81db0b65308dc (patch) | |
tree | e73f39feadef6f8d6cd6500ba7769bccc5e3bc7c | |
parent | 13654d28a70768e171e1aa2bdaaa43c8ccf7a1d8 (diff) | |
download | pentadactyl-187a53c4cae837585dd4254329e81db0b65308dc.tar.gz |
add 'maxitems' option (Jarkko Oranen)
-rw-r--r-- | common/content/ui.js | 25 | ||||
-rw-r--r-- | vimperator/AUTHORS | 1 | ||||
-rw-r--r-- | vimperator/NEWS | 1 | ||||
-rw-r--r-- | vimperator/locale/en-US/options.txt | 6 |
4 files changed, 23 insertions, 10 deletions
diff --git a/common/content/ui.js b/common/content/ui.js index fc55d93a..583104bd 100644 --- a/common/content/ui.js +++ b/common/content/ui.js @@ -777,6 +777,11 @@ function CommandLine() //{{{ "number", 500, { validator: function (value) value >= 0 }); + options.add(["maxitems"], + "Maximum number of items to display at once", + "number", 20, + { validator: function (value) value >= 0 }); + options.add(["messages", "msgs"], "Number of messages to store in the message history", "number", 100, @@ -1725,8 +1730,6 @@ function ItemList(id) //{{{ ////////////////////// PRIVATE SECTION ///////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ - const CONTEXT_LINES = 3; - var maxItems = 20; var completionElements = []; var iframe = document.getElementById(id); @@ -1782,7 +1785,7 @@ function ItemList(id) //{{{ <div key="completions"/> <div highlight="Completions"> { - template.map(util.range(0, maxItems * 2), function (i) + template.map(util.range(0, options["maxitems"] * 2), function (i) <span highlight="CompItem"> <li highlight="NonText">~</li> </span>) @@ -1818,7 +1821,7 @@ function ItemList(id) //{{{ * Uses the entries in "items" to fill the listbox and does incremental * filling to speed up things. * - * @param {number} offset Start at this index and show maxItems. + * @param {number} offset Start at this index and show options["maxitems"]. */ function fill(offset) { @@ -1828,11 +1831,11 @@ function ItemList(id) //{{{ return false; startIndex = offset; - endIndex = Math.min(startIndex + maxItems, items.allItems.items.length); + endIndex = Math.min(startIndex + options["maxitems"], items.allItems.items.length); let haveCompletions = false; let off = 0; - let end = startIndex + maxItems; + let end = startIndex + options["maxitems"]; function getRows(context) { function fix(n) Math.max(0, Math.min(len, n)); @@ -1946,6 +1949,8 @@ function ItemList(id) //{{{ let sel = selIndex; let len = items.allItems.items.length; let newOffset = startIndex; + let maxItems = options["maxitems"]; + let contextLines = (maxItems > 3)? 3 : Math.max(0, maxItems - 1); if (index == -1 || index == null || index == len) // wrapped around { @@ -1956,10 +1961,10 @@ function ItemList(id) //{{{ } else { - if (index <= startIndex + CONTEXT_LINES) - newOffset = index - CONTEXT_LINES; - if (index >= endIndex - CONTEXT_LINES) - newOffset = index + CONTEXT_LINES - maxItems + 1; + if (index <= startIndex + contextLines) + newOffset = index - contextLines; + if (index >= endIndex - contextLines) + newOffset = index + contextLines - maxItems + 1; newOffset = Math.min(newOffset, len - maxItems); newOffset = Math.max(newOffset, 0); diff --git a/vimperator/AUTHORS b/vimperator/AUTHORS index 73e4075d..754dc698 100644 --- a/vimperator/AUTHORS +++ b/vimperator/AUTHORS @@ -39,3 +39,4 @@ Patches (in no special order): * Ryan Zheng (ctrl-x/a support) * Dan Boger (:set online support) * Štěpán Němec (help copy-editing and favicon support) + * Jarkko Oranen ('maxitems' option) diff --git a/vimperator/NEWS b/vimperator/NEWS index b5751b55..5603ff68 100644 --- a/vimperator/NEWS +++ b/vimperator/NEWS @@ -5,6 +5,7 @@ * add ' and " local marks * add "w" and "W" Normal mode mappings for symmetry with o/O and t/T * add :messclear + * add 'maxitems' configuration variable 2009-03-28: * version 2.0 diff --git a/vimperator/locale/en-US/options.txt b/vimperator/locale/en-US/options.txt index c434cb79..7b4a5295 100644 --- a/vimperator/locale/en-US/options.txt +++ b/vimperator/locale/en-US/options.txt @@ -480,6 +480,12 @@ load plugins earlier, use the [c]:loadplugins[c] command within the vimperatorrc. ____ +|\'maxitems'| +||'maxitems'|| number (default: 20) +____ +Maximum number of items to display at once in a listing. +____ + |\'msgs'| |\'messages'| ||'messages' 'msgs'|| number (default: 100) |