mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 15:47:59 +01:00
add 'maxitems' option (Jarkko Oranen)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user