mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 10:57:58 +01:00
Merge branch 'master' into vimperator-2.1
This commit is contained in:
@@ -208,7 +208,8 @@ function Buffer() //{{{
|
||||
"Start caret mode",
|
||||
function ()
|
||||
{
|
||||
// setting this option triggers an observer which takes care of the mode setting
|
||||
// setting this option notifies an observer which takes care of the
|
||||
// mode setting
|
||||
options.setPref("accessibility.browsewithcaret", true);
|
||||
});
|
||||
|
||||
|
||||
@@ -923,6 +923,23 @@ function Editor() //{{{
|
||||
// 1 not !: opposite mode (first), add/change 'second' and END
|
||||
// 1 not !: same mode (first), overwrite first this END
|
||||
//
|
||||
// TODO: I don't like these funky filters, I am a funky filter hater. --djk
|
||||
// : make this a separate object
|
||||
// : use Struct for individual abbreviations
|
||||
// : rename "filter" arg "mode"
|
||||
/**
|
||||
* Adds a new abbreviation. Abbreviations consist of a LHS (the text
|
||||
* that is replaced when the abbreviation is expanded) and a RHS (the
|
||||
* replacement text).
|
||||
*
|
||||
* @param {string} filter The mode filter. This specifies the modes in
|
||||
* which this abbreviation is available. Either:
|
||||
* "c" - applies in command-line mode
|
||||
* "i" - applies in insert mode
|
||||
* "!" - applies in both command-line and insert modes
|
||||
* @param {string} lhs The LHS of the abbreviation.
|
||||
* @param {string} rhs The RHS of the abbreviation.
|
||||
*/
|
||||
addAbbreviation: function (filter, lhs, rhs)
|
||||
{
|
||||
if (!abbreviations[lhs])
|
||||
@@ -980,7 +997,12 @@ function Editor() //{{{
|
||||
abbreviations[lhs][0] = [filter, rhs];
|
||||
},
|
||||
|
||||
expandAbbreviation: function (filter) // try to find an candidate and replace accordingly
|
||||
/**
|
||||
* Expands an abbreviation in the currently active textbox.
|
||||
*
|
||||
* @param {string} filter The mode filter. (@see #addAbbreviation)
|
||||
*/
|
||||
expandAbbreviation: function (filter)
|
||||
{
|
||||
let textbox = getEditor();
|
||||
if (!textbox)
|
||||
@@ -1012,15 +1034,29 @@ function Editor() //{{{
|
||||
return true;
|
||||
},
|
||||
|
||||
// filter is i, c or "!" (insert or command abbreviations or both)
|
||||
// ! -> list all, on c or i ! matches too
|
||||
/**
|
||||
* Returns all abbreviations matching <b>filter</b> and <b>lhs</b>.
|
||||
*
|
||||
* @param {string} filter The mode filter. (@see #addAbbreviation)
|
||||
* @param {string} lhs The LHS of the abbreviation.
|
||||
* (@see #addAbbreviation)
|
||||
* @returns {Array} The matching abbreviations [mode, lhs, rhs]
|
||||
*/
|
||||
getAbbreviations: function (filter, lhs)
|
||||
{
|
||||
// ! -> list all, on c or i ! matches too
|
||||
let searchFilter = (filter == "!") ? "!ci" : filter + "!";
|
||||
return list = [[mode, left, right] for ([left, [mode, right]] in abbrevs())
|
||||
if (searchFilter.indexOf(mode) >= 0 && left.indexOf(lhs || "") == 0)];
|
||||
},
|
||||
|
||||
/**
|
||||
* Lists all abbreviations matching <b>filter</b> and <b>lhs</b>.
|
||||
*
|
||||
* @param {string} filter The mode filter. (@see #addAbbreviation)
|
||||
* @param {string} lhs The LHS of the abbreviation.
|
||||
* (@see #addAbbreviation)
|
||||
*/
|
||||
listAbbreviations: function (filter, lhs)
|
||||
{
|
||||
let list = this.getAbbreviations(filter, lhs);
|
||||
@@ -1042,6 +1078,13 @@ function Editor() //{{{
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Deletes all abbreviations matching <b>filter</b> and <b>lhs</b>.
|
||||
*
|
||||
* @param {string} filter The mode filter. (@see #addAbbreviation)
|
||||
* @param {string} lhs The LHS of the abbreviation.
|
||||
* (@see #addAbbreviation)
|
||||
*/
|
||||
removeAbbreviation: function (filter, lhs)
|
||||
{
|
||||
if (!lhs)
|
||||
@@ -1088,23 +1131,17 @@ function Editor() //{{{
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Removes all abbreviations matching <b>filter</b>.
|
||||
*
|
||||
* @param {string} filter The mode filter. (@see #addAbbreviation)
|
||||
*/
|
||||
removeAllAbbreviations: function (filter)
|
||||
{
|
||||
if (filter == "!")
|
||||
{
|
||||
abbreviations = {};
|
||||
}
|
||||
else
|
||||
{
|
||||
for (let lhs in abbreviations)
|
||||
{
|
||||
for (let i = 0; i < abbreviations[lhs].length; i++)
|
||||
{
|
||||
if (abbreviations[lhs][i][0] == "!" || abbreviations[lhs][i][0] == filter)
|
||||
this.removeAbbreviation(filter, lhs);
|
||||
}
|
||||
}
|
||||
}
|
||||
let searchFilter = (filter == "!") ? "!ci" : filter + "!";
|
||||
for ([lhs, [mode, rhs]] in abbrevs())
|
||||
if (searchFilter.indexOf(mode) >= 0)
|
||||
this.removeAbbreviation(filter, lhs);
|
||||
}
|
||||
//}}}
|
||||
};
|
||||
|
||||
@@ -37,6 +37,7 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
||||
// : 'linksearch' searches should highlight link matches only
|
||||
// : changing any search settings should also update the search state including highlighting
|
||||
// : incremental searches shouldn't permanently update search modifiers
|
||||
// : normalise the use of "search" vs "find" and rename callbacks
|
||||
|
||||
// make sure you only create this object when the "liberator" object is ready
|
||||
/**
|
||||
@@ -320,8 +321,13 @@ function Search() //{{{
|
||||
|
||||
return {
|
||||
|
||||
// Called when the search dialog is asked for
|
||||
// If you omit "mode", it will default to forward searching
|
||||
/**
|
||||
* Called when the search dialog is requested.
|
||||
*
|
||||
* @param {number} mode The search mode, either modes.SEARCH_FORWARD or
|
||||
* modes.SEARCH_BACKWARD.
|
||||
* @default modes.SEARCH_FORWARD
|
||||
*/
|
||||
openSearchDialog: function (mode)
|
||||
{
|
||||
if (mode == modes.SEARCH_BACKWARD)
|
||||
@@ -338,14 +344,17 @@ function Search() //{{{
|
||||
// TODO: focus the top of the currently visible screen
|
||||
},
|
||||
|
||||
// Finds text in a page
|
||||
// TODO: backwards seems impossible i fear :(
|
||||
find: function (str, backwards)
|
||||
/**
|
||||
* Searches the current buffer for <b>str</b>.
|
||||
*
|
||||
* @param {string} str The string to find.
|
||||
*/
|
||||
find: function (str)
|
||||
{
|
||||
let fastFind = getBrowser().fastFind;
|
||||
|
||||
processUserPattern(str);
|
||||
|
||||
fastFind.caseSensitive = caseSensitive;
|
||||
found = fastFind.find(searchString, linksOnly) != Ci.nsITypeAheadFind.FIND_NOTFOUND;
|
||||
|
||||
@@ -355,10 +364,16 @@ function Search() //{{{
|
||||
return found;
|
||||
},
|
||||
|
||||
// Called when the current search needs to be repeated
|
||||
/**
|
||||
* Searches the current buffer again for the most recently used search
|
||||
* string.
|
||||
*
|
||||
* @param {boolean} reverse Whether to search forwards or backwards.
|
||||
* @default false
|
||||
*/
|
||||
findAgain: function (reverse)
|
||||
{
|
||||
// this hack is needed to make n/N work with the correct string, if
|
||||
// This hack is needed to make n/N work with the correct string, if
|
||||
// we typed /foo<esc> after the original search. Since searchString is
|
||||
// readonly we have to call find() again to update it.
|
||||
if (getBrowser().fastFind.searchString != lastSearchString)
|
||||
@@ -393,15 +408,27 @@ function Search() //{{{
|
||||
}
|
||||
},
|
||||
|
||||
// Called when the user types a key in the search dialog. Triggers a find attempt if 'incsearch' is set
|
||||
/**
|
||||
* Called when the user types a key in the search dialog. Triggers a
|
||||
* search attempt if 'incsearch' is set.
|
||||
*
|
||||
* @param {string} command The search string.
|
||||
*/
|
||||
searchKeyPressed: function (command)
|
||||
{
|
||||
if (options["incsearch"])
|
||||
this.find(command, backwards);
|
||||
},
|
||||
|
||||
// Called when the enter key is pressed to trigger a search
|
||||
// use forcedBackward if you call this function directly
|
||||
/**
|
||||
* Called when the <Enter> key is pressed to trigger a search.
|
||||
*
|
||||
* @param {string} command The search string.
|
||||
* @param {boolean} forcedBackward Whether to search forwards or
|
||||
* backwards. This overrides the direction set in
|
||||
* (@link #openSearchDialog).
|
||||
* @default false
|
||||
*/
|
||||
searchSubmitted: function (command, forcedBackward)
|
||||
{
|
||||
if (typeof forcedBackward === "boolean")
|
||||
@@ -432,16 +459,22 @@ function Search() //{{{
|
||||
modes.reset();
|
||||
},
|
||||
|
||||
// Called when the search is canceled - for example if someone presses
|
||||
// escape while typing a search
|
||||
/**
|
||||
* Called when the search is canceled. For example, if someone presses
|
||||
* <Esc> while typing a search.
|
||||
*/
|
||||
searchCanceled: function ()
|
||||
{
|
||||
// TODO: code to reposition the document to the place before search started
|
||||
},
|
||||
|
||||
// FIXME: Thunderbird incompatible
|
||||
// this is not dependent on the value of 'hlsearch'
|
||||
highlight: function (text)
|
||||
/**
|
||||
* Highlights all occurances of <b>str</b> in the buffer.
|
||||
*
|
||||
* @param str The string to highlight.
|
||||
*/
|
||||
highlight: function (str)
|
||||
{
|
||||
if (config.name == "Muttator")
|
||||
return;
|
||||
@@ -450,10 +483,10 @@ function Search() //{{{
|
||||
if (highlightObj.getSpans(content.document).snapshotLength > 0)
|
||||
return;
|
||||
|
||||
if (!text)
|
||||
text = lastSearchString;
|
||||
if (!str)
|
||||
str = lastSearchString;
|
||||
|
||||
highlightObj.highlightDoc(window.content, text);
|
||||
highlightObj.highlightDoc(window.content, str);
|
||||
|
||||
// recreate selection since _highlightDoc collapses the selection backwards
|
||||
getBrowser().fastFind.findAgain(false, linksOnly);
|
||||
@@ -461,8 +494,12 @@ function Search() //{{{
|
||||
// TODO: remove highlighting from non-link matches (HTML - A/AREA with href attribute; XML - Xlink [type="simple"])
|
||||
},
|
||||
|
||||
/**
|
||||
* Clears all search highlighting.
|
||||
*/
|
||||
clear: function ()
|
||||
{
|
||||
// FIXME: moves the selection
|
||||
highlightObj.highlightDoc(window.content);
|
||||
// need to manually collapse the selection if the document is not
|
||||
// highlighted
|
||||
|
||||
@@ -624,6 +624,7 @@ const liberator = (function () //{{{
|
||||
// "complete"
|
||||
// TODO: "zoom": if the zoom value of the current buffer changed
|
||||
// TODO: move to ui.js?
|
||||
// Yes --djk
|
||||
registerCallback: function (type, mode, func)
|
||||
{
|
||||
if (!(type in callbacks))
|
||||
|
||||
@@ -734,9 +734,9 @@ function History() //{{{
|
||||
{
|
||||
let sh = window.getWebNavigation().sessionHistory;
|
||||
|
||||
context.anchor = false;
|
||||
context.completions = [sh.getEntryAtIndex(i, false) for (i in util.range(sh.index, 0, true))];
|
||||
context.keys = { text: function (item) item.URI.spec, description: "title" };
|
||||
liberator.dump(context.items);
|
||||
},
|
||||
count: true,
|
||||
literal: 0
|
||||
@@ -780,6 +780,7 @@ function History() //{{{
|
||||
{
|
||||
let sh = window.getWebNavigation().sessionHistory;
|
||||
|
||||
context.anchor = false;
|
||||
context.completions = [sh.getEntryAtIndex(i, false) for (i in util.range(sh.index + 1, sh.count))];
|
||||
context.keys = { text: function (item) item.URI.spec, description: "title" };
|
||||
},
|
||||
|
||||
@@ -207,7 +207,7 @@ section:Ex{nbsp}commands[ex-cmd-index,:index]
|
||||
||:pageinfo|| Show various page information +
|
||||
||:pagestyle|| Select the author style sheet to apply +
|
||||
||:play|| Replay a recorded macro +
|
||||
||:preferences|| Show Firefox preferences +
|
||||
||:preferences|| Show Firefox preferences dialog +
|
||||
||:pwd|| Print the current directory name +
|
||||
||:qmark|| Mark a URL with a letter for quick access +
|
||||
||:qmarks|| Show all QuickMarks +
|
||||
|
||||
@@ -162,21 +162,18 @@ Environment variables are expanded for path options like 'cdpath' and
|
||||
'runtimepath'. The variable notation is _$VAR_ (terminated by a non-word
|
||||
character) or _$\\{VAR}_. _%VAR%_ is also supported on Windows.
|
||||
|
||||
section:Setting{nbsp}Firefox{nbsp}options[firefox-options]
|
||||
section:Setting{nbsp}Firefox{nbsp}options[firefox-options,preferences]
|
||||
|
||||
Most Firefox options are not touched/overridden by Vimperator. In order to set
|
||||
any of these preferences use either of the following:
|
||||
Firefox options can be viewed and set with the following commands:
|
||||
|
||||
|:prefs| |:preferences|
|
||||
||:pref[erences]||
|
||||
________________________________________________________________________________
|
||||
Show Browser Preferences +
|
||||
You can change the browser preferences from this dialog. Be aware that not
|
||||
all Firefox preferences work, because Vimperator overrides some key
|
||||
bindings and changes Firefox's GUI.
|
||||
Show the Firefox preferences dialog. You can change the browser preferences
|
||||
from this dialog. Be aware that not all Firefox preferences work, because
|
||||
Vimperator overrides some key bindings and changes Firefox's GUI.
|
||||
________________________________________________________________________________
|
||||
|
||||
|
||||
|:prefs!| |:preferences!|
|
||||
||:pref[erences]!||
|
||||
________________________________________________________________________________
|
||||
@@ -184,7 +181,6 @@ Opens about:config in the current tab where you can change advanced Firefox
|
||||
preferences.
|
||||
________________________________________________________________________________
|
||||
|
||||
|
||||
|:set!| |:set-!|
|
||||
||:se[t]! {preference}={value}|| +
|
||||
________________________________________________________________________________
|
||||
@@ -192,6 +188,19 @@ Change any Firefox {preference} (those in the about:config window). You can also
|
||||
reset/delete those preferences with [c]:set! {preference}&[c].
|
||||
________________________________________________________________________________
|
||||
|
||||
|overridden-preferences| +
|
||||
|
||||
Vimperator sets several Firefox preferences at startup. If this is undesirable,
|
||||
they can be changed to a different value in your RC file using
|
||||
[c]:set! {preference}={value}[c]
|
||||
|
||||
The following preferences are set:
|
||||
|
||||
* browser.startup.page
|
||||
* dom.popup_allowed_events
|
||||
|
||||
// TODO: others?
|
||||
|
||||
section:List{nbsp}of{nbsp}options[list-options]
|
||||
|
||||
|\'act'| |\'activate'|
|
||||
@@ -275,11 +284,9 @@ ____
|
||||
|\'eht'| |\'extendedhinttags'|
|
||||
||'extendedhinttags' 'eht'|| string
|
||||
____
|
||||
(default: +++//*[@onclick or @onmouseover
|
||||
or @onmousedown or @onmouseup or @oncommand or @class='lk' or @class='s'] |
|
||||
//input[not(@type='hidden')] | //a | //area | //iframe | //textarea | //button
|
||||
| //select | //xhtml:*[@onclick or @onmouseover or @onmousedown or @onmouseup
|
||||
or @oncommand or @class='lk' or @class='s'] |
|
||||
(default: +++//*[@onclick or @onmouseover or @onmousedown or @onmouseup or
|
||||
@oncommand or @class='lk' or @role='link'] | //input[not(@type='hidden')] | //a
|
||||
| //area | //iframe | //textarea | //button | //select |
|
||||
//xhtml:input[not(@type='hidden')] | //xhtml:a | //xhtml:area | //xhtml:iframe
|
||||
| //xhtml:textarea | //xhtml:button | //xhtml:select+++)
|
||||
|
||||
@@ -385,11 +392,10 @@ ____
|
||||
||'hinttags' 'ht'|| string
|
||||
____
|
||||
(default: +++//*[@onclick or @onmouseover or @onmousedown or @onmouseup or
|
||||
@oncommand or @class='lk' or @class='s'] | //input[not(@type='hidden')] | //a
|
||||
| //area | //iframe | //textarea | //button | //select | //xhtml:*[@onclick or
|
||||
@onmouseover or @onmousedown or @onmouseup or @oncommand or @class='lk' or
|
||||
@class='s'] | //xhtml:input[not(@type='hidden')] | //xhtml:a | //xhtml:area |
|
||||
//xhtml:iframe | //xhtml:textarea | //xhtml:button | //xhtml:select+++)
|
||||
@oncommand or @class='lk' or @role='link'] | //input[not(@type='hidden')] | //a
|
||||
| //area | //iframe | //textarea | //button | //select |
|
||||
//xhtml:input[not(@type='hidden')] | //xhtml:a | //xhtml:area | //xhtml:iframe
|
||||
| //xhtml:textarea | //xhtml:button | //xhtml:select+++)
|
||||
|
||||
XPath string of hintable elements activated by [m]f[m] and [m]F[m]
|
||||
____
|
||||
@@ -601,6 +607,7 @@ ____
|
||||
(default: _$VIMPERATOR_RUNTIME_ or Unix, Mac: "\~/.vimperator", Windows: "\~/vimperator")
|
||||
|
||||
List of directories searched for runtime files: +
|
||||
colors/ +
|
||||
macros/ +
|
||||
plugin/ +
|
||||
|
||||
|
||||
Reference in New Issue
Block a user