mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 22:57:58 +01:00
normalize foldmarkers
This commit is contained in:
@@ -28,12 +28,16 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
|||||||
|
|
||||||
vimperator.Completion = function () //{{{
|
vimperator.Completion = function () //{{{
|
||||||
{
|
{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||||
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
// the completion substrings, used for showing the longest common match
|
// the completion substrings, used for showing the longest common match
|
||||||
var substrings = [];
|
var substrings = [];
|
||||||
|
|
||||||
// function uses smartcase
|
// function uses smartcase
|
||||||
// list = [ [['com1', 'com2'], 'text'], [['com3', 'com4'], 'text'] ]
|
// list = [ [['com1', 'com2'], 'text'], [['com3', 'com4'], 'text'] ]
|
||||||
function buildLongestCommonSubstring(list, filter) //{{{
|
function buildLongestCommonSubstring(list, filter)
|
||||||
{
|
{
|
||||||
var filtered = [];
|
var filtered = [];
|
||||||
var ignorecase = false;
|
var ignorecase = false;
|
||||||
@@ -72,10 +76,10 @@ vimperator.Completion = function () // {{{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return filtered;
|
return filtered;
|
||||||
} //}}}
|
}
|
||||||
|
|
||||||
// this function is case sensitive and should be documented about input and output ;)
|
// this function is case sensitive and should be documented about input and output ;)
|
||||||
function buildLongestStartingSubstring(list, filter) //{{{
|
function buildLongestStartingSubstring(list, filter)
|
||||||
{
|
{
|
||||||
var filtered = [];
|
var filtered = [];
|
||||||
for (var i = 0; i < list.length; i++)
|
for (var i = 0; i < list.length; i++)
|
||||||
@@ -102,13 +106,17 @@ vimperator.Completion = function () // {{{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return filtered;
|
return filtered;
|
||||||
} //}}}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
|
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||||
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
||||||
// returns the longest common substring
|
// returns the longest common substring
|
||||||
// used for the 'longest' setting for wildmode
|
// used for the 'longest' setting for wildmode
|
||||||
getLongestSubstring: function () //{{{
|
getLongestSubstring: function ()
|
||||||
{
|
{
|
||||||
if (substrings.length == 0)
|
if (substrings.length == 0)
|
||||||
return "";
|
return "";
|
||||||
@@ -120,9 +128,9 @@ vimperator.Completion = function () // {{{
|
|||||||
longest = substrings[i];
|
longest = substrings[i];
|
||||||
}
|
}
|
||||||
return longest;
|
return longest;
|
||||||
}, //}}}
|
},
|
||||||
|
|
||||||
dialog: function (filter) //{{{
|
dialog: function (filter)
|
||||||
{
|
{
|
||||||
substrings = [];
|
substrings = [];
|
||||||
var nodes = [
|
var nodes = [
|
||||||
@@ -155,14 +163,14 @@ vimperator.Completion = function () // {{{
|
|||||||
});
|
});
|
||||||
|
|
||||||
return buildLongestCommonSubstring(mapped, filter);
|
return buildLongestCommonSubstring(mapped, filter);
|
||||||
}, //}}}
|
},
|
||||||
|
|
||||||
// filter a list of urls
|
// filter a list of urls
|
||||||
//
|
//
|
||||||
// may consist of searchengines, filenames, bookmarks and history,
|
// may consist of searchengines, filenames, bookmarks and history,
|
||||||
// depending on the 'complete' option
|
// depending on the 'complete' option
|
||||||
// if the 'complete' argument is passed like "h", it temporarily overrides the complete option
|
// if the 'complete' argument is passed like "h", it temporarily overrides the complete option
|
||||||
url: function (filter, complete) //{{{
|
url: function (filter, complete)
|
||||||
{
|
{
|
||||||
var completions = [];
|
var completions = [];
|
||||||
substrings = [];
|
substrings = [];
|
||||||
@@ -182,9 +190,9 @@ vimperator.Completion = function () // {{{
|
|||||||
}
|
}
|
||||||
|
|
||||||
return completions;
|
return completions;
|
||||||
}, //}}}
|
},
|
||||||
|
|
||||||
search: function (filter) //{{{
|
search: function (filter)
|
||||||
{
|
{
|
||||||
var engines = vimperator.bookmarks.getSearchEngines().concat(vimperator.bookmarks.getKeywords());
|
var engines = vimperator.bookmarks.getSearchEngines().concat(vimperator.bookmarks.getKeywords());
|
||||||
|
|
||||||
@@ -195,7 +203,7 @@ vimperator.Completion = function () // {{{
|
|||||||
return [[engine[0]], engine[1]];
|
return [[engine[0]], engine[1]];
|
||||||
});
|
});
|
||||||
return buildLongestCommonSubstring(mapped, filter);
|
return buildLongestCommonSubstring(mapped, filter);
|
||||||
}, //}}}
|
},
|
||||||
|
|
||||||
// TODO: support file:// and \ or / path separators on both platforms
|
// TODO: support file:// and \ or / path separators on both platforms
|
||||||
file: function (filter)
|
file: function (filter)
|
||||||
@@ -230,7 +238,7 @@ vimperator.Completion = function () // {{{
|
|||||||
return buildLongestStartingSubstring(mapped, filter);
|
return buildLongestStartingSubstring(mapped, filter);
|
||||||
},
|
},
|
||||||
|
|
||||||
help: function (filter) //{{{
|
help: function (filter)
|
||||||
{
|
{
|
||||||
var helpArray = [[["introduction"], "Introductory text"],
|
var helpArray = [[["introduction"], "Introductory text"],
|
||||||
[["initialization"], "Initialization and startup"],
|
[["initialization"], "Initialization and startup"],
|
||||||
@@ -255,9 +263,9 @@ vimperator.Completion = function () // {{{
|
|||||||
});
|
});
|
||||||
|
|
||||||
return buildLongestCommonSubstring(helpArray, filter);
|
return buildLongestCommonSubstring(helpArray, filter);
|
||||||
}, //}}}
|
},
|
||||||
|
|
||||||
command: function (filter) //{{{
|
command: function (filter)
|
||||||
{
|
{
|
||||||
substrings = [];
|
substrings = [];
|
||||||
var completions = [];
|
var completions = [];
|
||||||
@@ -271,9 +279,9 @@ vimperator.Completion = function () // {{{
|
|||||||
for (var command in vimperator.commands)
|
for (var command in vimperator.commands)
|
||||||
completions.push([command.longNames, command.shortHelp]);
|
completions.push([command.longNames, command.shortHelp]);
|
||||||
return buildLongestStartingSubstring(completions, filter);
|
return buildLongestStartingSubstring(completions, filter);
|
||||||
}, //}}}
|
},
|
||||||
|
|
||||||
option: function (filter, unfiltered) //{{{
|
option: function (filter, unfiltered)
|
||||||
{
|
{
|
||||||
substrings = [];
|
substrings = [];
|
||||||
var optionCompletions = [];
|
var optionCompletions = [];
|
||||||
@@ -350,9 +358,9 @@ vimperator.Completion = function () // {{{
|
|||||||
}
|
}
|
||||||
|
|
||||||
return optionCompletions;
|
return optionCompletions;
|
||||||
}, //}}}
|
},
|
||||||
|
|
||||||
buffer: function (filter) //{{{
|
buffer: function (filter)
|
||||||
{
|
{
|
||||||
substrings = [];
|
substrings = [];
|
||||||
var items = [];
|
var items = [];
|
||||||
@@ -386,9 +394,9 @@ vimperator.Completion = function () // {{{
|
|||||||
return [$_[0][0], $_[1]];
|
return [$_[0][0], $_[1]];
|
||||||
});
|
});
|
||||||
return buildLongestCommonSubstring(items, filter);
|
return buildLongestCommonSubstring(items, filter);
|
||||||
}, //}}}
|
},
|
||||||
|
|
||||||
sidebar: function (filter) //{{{
|
sidebar: function (filter)
|
||||||
{
|
{
|
||||||
substrings = [];
|
substrings = [];
|
||||||
var menu = document.getElementById("viewSidebarMenu");
|
var menu = document.getElementById("viewSidebarMenu");
|
||||||
@@ -405,9 +413,9 @@ vimperator.Completion = function () // {{{
|
|||||||
});
|
});
|
||||||
|
|
||||||
return buildLongestCommonSubstring(mapped, filter);
|
return buildLongestCommonSubstring(mapped, filter);
|
||||||
}, //}}}
|
},
|
||||||
|
|
||||||
javascript: function (str) // {{{
|
javascript: function (str)
|
||||||
{
|
{
|
||||||
substrings = [];
|
substrings = [];
|
||||||
var matches = str.match(/^(.*?)(\s*\.\s*)?(\w*)$/);
|
var matches = str.match(/^(.*?)(\s*\.\s*)?(\w*)$/);
|
||||||
@@ -481,12 +489,12 @@ vimperator.Completion = function () // {{{
|
|||||||
}
|
}
|
||||||
|
|
||||||
return buildLongestStartingSubstring(completions, filter);
|
return buildLongestStartingSubstring(completions, filter);
|
||||||
}, // }}}
|
},
|
||||||
|
|
||||||
// discard all entries in the 'urls' array, which don't match 'filter
|
// discard all entries in the 'urls' array, which don't match 'filter
|
||||||
// urls must be of type [["url", "title"], [...]] or optionally
|
// urls must be of type [["url", "title"], [...]] or optionally
|
||||||
// [["url", "title", keyword, [tags]], [...]]
|
// [["url", "title", keyword, [tags]], [...]]
|
||||||
filterURLArray: function (urls, filter, tags) //{{{
|
filterURLArray: function (urls, filter, tags)
|
||||||
{
|
{
|
||||||
var filtered = [];
|
var filtered = [];
|
||||||
// completions which don't match the url but just the description
|
// completions which don't match the url but just the description
|
||||||
@@ -578,7 +586,7 @@ vimperator.Completion = function () // {{{
|
|||||||
}
|
}
|
||||||
|
|
||||||
return filtered.concat(additionalCompletions);
|
return filtered.concat(additionalCompletions);
|
||||||
}, //}}}
|
},
|
||||||
|
|
||||||
// generic helper function which checks if the given "items" array pass "filter"
|
// generic helper function which checks if the given "items" array pass "filter"
|
||||||
// items must be an array of strings
|
// items must be an array of strings
|
||||||
@@ -601,7 +609,7 @@ vimperator.Completion = function () // {{{
|
|||||||
},
|
},
|
||||||
|
|
||||||
// FIXME: rename
|
// FIXME: rename
|
||||||
exTabCompletion: function (str) //{{{
|
exTabCompletion: function (str)
|
||||||
{
|
{
|
||||||
var [count, cmd, special, args] = vimperator.commands.parseCommand(str);
|
var [count, cmd, special, args] = vimperator.commands.parseCommand(str);
|
||||||
var completions = [];
|
var completions = [];
|
||||||
@@ -644,9 +652,10 @@ vimperator.Completion = function () // {{{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return [start, completions];
|
return [start, completions];
|
||||||
} //}}}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
//}}}
|
||||||
}; //}}}
|
}; //}}}
|
||||||
|
|
||||||
// vim: set fdm=marker sw=4 ts=4 et:
|
// vim: set fdm=marker sw=4 ts=4 et:
|
||||||
|
|||||||
@@ -31,6 +31,10 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
|||||||
|
|
||||||
vimperator.Editor = function () //{{{
|
vimperator.Editor = function () //{{{
|
||||||
{
|
{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||||
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
// store our last search with f, F, t or T
|
// store our last search with f, F, t or T
|
||||||
var lastFindChar = null;
|
var lastFindChar = null;
|
||||||
var lastFindCharFunc = null;
|
var lastFindCharFunc = null;
|
||||||
@@ -50,6 +54,10 @@ vimperator.Editor = function () //{{{
|
|||||||
return ed.controllers.getControllerForCommand("cmd_beginLine");
|
return ed.controllers.getControllerForCommand("cmd_beginLine");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
|
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||||
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
||||||
line: function ()
|
line: function ()
|
||||||
@@ -640,9 +648,10 @@ vimperator.Editor = function () //{{{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} //}}}
|
}
|
||||||
|
//}}}
|
||||||
};
|
};
|
||||||
|
//}}}
|
||||||
}; //}}}
|
}; //}}}
|
||||||
|
|
||||||
// vim: set fdm=marker sw=4 ts=4 et:
|
// vim: set fdm=marker sw=4 ts=4 et:
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
|||||||
// make sure you only create this object when the "vimperator" object is ready
|
// make sure you only create this object when the "vimperator" object is ready
|
||||||
vimperator.Search = function () //{{{
|
vimperator.Search = function () //{{{
|
||||||
{
|
{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||||
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
// FIXME:
|
// FIXME:
|
||||||
//var self = this; // needed for callbacks since "this" is the "vimperator" object in a callback
|
//var self = this; // needed for callbacks since "this" is the "vimperator" object in a callback
|
||||||
var found = false; // true if the last search was successful
|
var found = false; // true if the last search was successful
|
||||||
@@ -105,6 +109,10 @@ vimperator.Search = function () //{{{
|
|||||||
searchString = pattern;
|
searchString = pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
|
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||||
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
||||||
// Called when the search dialog is asked for
|
// Called when the search dialog is asked for
|
||||||
@@ -260,6 +268,7 @@ vimperator.Search = function () //{{{
|
|||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
//}}}
|
||||||
}; //}}}
|
}; //}}}
|
||||||
|
|
||||||
// vim: set fdm=marker sw=4 ts=4 et:
|
// vim: set fdm=marker sw=4 ts=4 et:
|
||||||
|
|||||||
@@ -27,11 +27,19 @@ the provisions above, a recipient may use your version of this file under
|
|||||||
the terms of any one of the MPL, the GPL or the LGPL.
|
the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
}}} ***** END LICENSE BLOCK *****/
|
}}} ***** END LICENSE BLOCK *****/
|
||||||
|
|
||||||
vimperator.IO = function ()
|
vimperator.IO = function ()//{{{
|
||||||
{
|
{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||||
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
var environmentService = Components.classes["@mozilla.org/process/environment;1"]
|
var environmentService = Components.classes["@mozilla.org/process/environment;1"]
|
||||||
.getService(Components.interfaces.nsIEnvironment);
|
.getService(Components.interfaces.nsIEnvironment);
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
|
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||||
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
||||||
MODE_RDONLY: 0x01,
|
MODE_RDONLY: 0x01,
|
||||||
@@ -235,6 +243,7 @@ vimperator.IO = function ()
|
|||||||
ofstream.close();
|
ofstream.close();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
//}}}
|
||||||
|
};//}}}
|
||||||
|
|
||||||
// vim: set fdm=marker sw=4 ts=4 et:
|
// vim: set fdm=marker sw=4 ts=4 et:
|
||||||
|
|||||||
@@ -26,8 +26,12 @@ the provisions above, a recipient may use your version of this file under
|
|||||||
the terms of any one of the MPL, the GPL or the LGPL.
|
the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
}}} ***** END LICENSE BLOCK *****/
|
}}} ***** END LICENSE BLOCK *****/
|
||||||
|
|
||||||
vimperator.modes = (function ()
|
vimperator.modes = (function ()//{{{
|
||||||
{
|
{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||||
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
var main = 1; // NORMAL
|
var main = 1; // NORMAL
|
||||||
var extended = 0; // NONE
|
var extended = 0; // NONE
|
||||||
|
|
||||||
@@ -123,6 +127,10 @@ vimperator.modes = (function ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
|
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||||
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
||||||
// main modes, only one should ever be active
|
// main modes, only one should ever be active
|
||||||
@@ -224,6 +232,7 @@ vimperator.modes = (function ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
})();
|
//}}}
|
||||||
|
})();//}}}
|
||||||
|
|
||||||
// vim: set fdm=marker sw=4 ts=4 et:
|
// vim: set fdm=marker sw=4 ts=4 et:
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ the provisions above, a recipient may use your version of this file under
|
|||||||
the terms of any one of the MPL, the GPL or the LGPL.
|
the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
}}} ***** END LICENSE BLOCK *****/
|
}}} ***** END LICENSE BLOCK *****/
|
||||||
|
|
||||||
vimperator.util = {
|
vimperator.util = { //{{{
|
||||||
|
|
||||||
escapeHTML: function (str)
|
escapeHTML: function (str)
|
||||||
{
|
{
|
||||||
@@ -208,6 +208,6 @@ vimperator.util = {
|
|||||||
return strNum[0] + " " + unitVal[unitIndex];
|
return strNum[0] + " " + unitVal[unitIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};//}}}
|
||||||
|
|
||||||
// vim: set fdm=marker sw=4 ts=4 et:
|
// vim: set fdm=marker sw=4 ts=4 et:
|
||||||
|
|||||||
Reference in New Issue
Block a user