1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 23:27:59 +01:00
--HG--
branch : testing
This commit is contained in:
Kris Maglione
2010-08-26 15:18:49 -04:00
11 changed files with 58 additions and 48 deletions

7
common/content/autocommands.js Normal file → Executable file
View File

@@ -196,7 +196,12 @@ const AutoCommands = Module("autocommands", {
}
}, {
bang: true,
completer: function (context) completion.autocmdEvent(context),
completer: function (context, args) {
if (args.length == 1)
return completion.autocmdEvent(context);
if (args.length == 3)
return args["-javascript"] ? completion.javascript(context) : completion.ex(context);
},
literal: 2,
options: [[["-javascript", "-js"], commands.OPTION_NOARG]]
});

5
common/content/completion.js Normal file → Executable file
View File

@@ -696,8 +696,11 @@ const Completion = Module("completion", {
if (skip)
context.advance(skip[0].length);
if (complete == null)
complete = options["complete"];
// Will, and should, throw an error if !(c in opts)
Array.forEach(complete || options["complete"], function (c) {
Array.forEach(complete, function (c) {
let completer = completion.urlCompleters[c];
context.fork.apply(context, [c, 0, completion, completer.completer].concat(completer.args));
});

8
common/content/io.js Normal file → Executable file
View File

@@ -924,7 +924,7 @@ lookup:
"List all sourced script names",
function () {
let list = template.tabular(["<SNR>", "Filename"], ["text-align: right; padding-right: 1em;"],
([i + 1, file] for ([i, file] in Iterator(this._scriptNames)))); // TODO: add colon and remove column titles for pedantic Vim compatibility?
([i + 1, file] for ([i, file] in Iterator(io._scriptNames)))); // TODO: add colon and remove column titles for pedantic Vim compatibility?
commandline.echo(list, commandline.HL_NORMAL, commandline.FORCE_MULTILINE);
},
@@ -954,16 +954,16 @@ lookup:
arg = "!" + arg;
// replaceable bang and no previous command?
liberator.assert(!/((^|[^\\])(\\\\)*)!/.test(arg) || this._lastRunCommand,
liberator.assert(!/((^|[^\\])(\\\\)*)!/.test(arg) || io._lastRunCommand,
"E34: No previous command");
// NOTE: Vim doesn't replace ! preceded by 2 or more backslashes and documents it - desirable?
// pass through a raw bang when escaped or substitute the last command
arg = arg.replace(/(\\)*!/g,
function (m) /^\\(\\\\)*!$/.test(m) ? m.replace("\\!", "!") : m.replace("!", this._lastRunCommand)
function (m) /^\\(\\\\)*!$/.test(m) ? m.replace("\\!", "!") : m.replace("!", io._lastRunCommand)
);
this._lastRunCommand = arg;
io._lastRunCommand = arg;
let output = io.system(arg);

10
common/content/statusline.js Normal file → Executable file
View File

@@ -63,7 +63,15 @@ const StatusLine = Module("statusline", {
function losslessDecodeURI(url) {
// 1. decodeURI decodes %25 to %, which creates unintended
// encoding sequences.
url = url.split("%25").map(decodeURI).join("%25");
url = url.split("%25").map(function (url) {
// Non-UTF-8 complient URLs cause "malformed URI sequence" errors.
try {
return decodeURI(url);
}
catch (e) {
return url;
}
}).join("%25");
// 2. Re-encode whitespace so that it doesn't get eaten away
// by the location bar (bug 410726).
url = url.replace(/[\r\n\t]/g, encodeURIComponent);

View File

@@ -18,14 +18,6 @@ const Util = Module("util", {
this.Array = Util.Array;
},
/**
* Returns true if its argument is an Array object, regardless
* of which context it comes from.
*
* @param {object} obj
*/
isArray: function isArray(obj) Object.prototype.toString.call(obj) == "[object Array]",
/**
* Returns a shallow copy of <b>obj</b>.
*
@@ -454,7 +446,7 @@ const Util = Module("util", {
doc = window.content.document;
if (!elem)
elem = doc;
if (util.isArray(expression))
if (isarray(expression))
expression = util.makeXPath(expression);
let result = doc.evaluate(expression, elem,

View File

@@ -35,17 +35,17 @@ const Mail = Module("mail", {
// Jump to a message when requested
let indices = [];
if (this._selectMessageKeys.length > 0) {
for (let j = 0; j < this._selectMessageKeys.length; j++)
indices.push([gDBView.findIndexFromKey(this._selectMessageKeys[j], true), this._selectMessageKeys[j]]);
if (mail._selectMessageKeys.length > 0) {
for (let j = 0; j < mail._selectMessageKeys.length; j++)
indices.push([gDBView.findIndexFromKey(mail._selectMessageKeys[j], true), mail._selectMessageKeys[j]]);
indices.sort();
let index = this._selectMessageCount - 1;
if (this._selectMessageReverse)
index = this._selectMessageKeys.length - 1 - index;
let index = mail._selectMessageCount - 1;
if (mail._selectMessageReverse)
index = mail._selectMessageKeys.length - 1 - index;
gDBView.selectMsgByKey(indices[index][1]);
this._selectMessageKeys = [];
mail._selectMessageKeys = [];
}
}
}

View File

@@ -2,9 +2,6 @@ Main developer/Project founder:
* Martin Stubenschrott (stubenschrott@vimperator.org)
Developers:
* Doug Kearns (dougkearns@gmail.com)
* Tim Hammerquist (penryu@gmail.com)
* Konstantin Stepanov (milezv@yandex.ru)
* Kris Maglione
* Ted Pavlic <ted@tedpavlic.com>
* anekos <anekos@snca.net>
@@ -16,6 +13,9 @@ Inactive/former developers:
* Viktor Kojouharov (Виктор Кожухаров)
* Marco Candrian (mac@calmar.ws)
* Daniel Bainton (dpb .AT. driftaway .DOT. org)
* Doug Kearns (dougkearns@gmail.com)
* Konstantin Stepanov (milezv@yandex.ru)
* Tim Hammerquist (penryu@gmail.com)
Patches (in no special order):
* Ruud Grosmann ('followhints' option)

1
vimperator/NEWS Normal file → Executable file
View File

@@ -10,6 +10,7 @@
* Asciidoc is no longer for building
* Remove [c]:edit[c], [c]:tabedit[c], and [c]:winedit[c]
* Add 'jsdebugger' option - switch on/off javascript debugger service
* Add "addons", "downloads", "extoptions" and "help" to the 'activate' option.
2009-10-28:
* version 2.2

View File

@@ -19,7 +19,7 @@
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>3.5</em:minVersion>
<em:maxVersion>3.6b3pre</em:maxVersion>
<em:maxVersion>4.0</em:maxVersion>
</Description>
</em:targetApplication>
</Description>

1
xulmus/NEWS Normal file → Executable file
View File

@@ -13,6 +13,7 @@
* rename [c]:filter[c] to [c]:queue[c] and [c]:Filter[c] to [c]:filter[c]
* add 'repeat' and 'shuffle'
* add 'jsdebugger' option - switch on/off javascript debugger service
* add "addons", "downloads", "extoptions" and "help" to the 'activate' option.
2009-03-28:
* version 0.1

View File

@@ -9,7 +9,7 @@ const Player = Module("player", {
init: function init() {
this._lastSearchString = "";
this._lastSearchIndex = 0;
this._lastSearchView = _SBGetCurrentView();
this._lastSearchView = this._currentView; //XXX
// Get the focus to the visible playlist first
//window._SBShowMainLibrary();
@@ -22,7 +22,7 @@ const Player = Module("player", {
},
/**
* Adjusts the track position <b>interval</b> milliseconds forwards or
* Moves the track position <b>interval</b> milliseconds forwards or
* backwards.
*
* @param {number} interval The time interval (ms) to move the track
@@ -79,6 +79,9 @@ const Player = Module("player", {
}
},
/** @property {sbIMediaListView} The current media list view. @private */
get _currentView() SBGetBrowser().currentMediaListView,
/**
* @property {number} The player volume in the range 0.0-1.0.
*/
@@ -88,16 +91,14 @@ const Player = Module("player", {
},
/**
* Focuses the specified media item in the current media view.
* Focuses the specified media item in the current media list view.
*
* @param {sbIMediaItem} mediaItem The media item to focus.
*/
focusTrack: function focusTrack(mediaItem) {
SBGetBrowser().mediaTab.mediaPage.highlightItem(_SBGetCurrentView().getIndexForItem(mediaItem));
SBGetBrowser().mediaTab.mediaPage.highlightItem(this._currentView.getIndexForItem(mediaItem));
},
// FIXME: can't be called from non-media tabs since 840e78 (git)
// _SBGetCurrentView only returns the view in that tab - use SBGetBrowser().currentMediaListView
/**
* Plays the currently selected media item. If no item is selected the
* first item in the current media view is played.
@@ -105,9 +106,9 @@ const Player = Module("player", {
play: function play() {
// Check if there is any selection in place, else play first item of the visible view.
// TODO: this approach, or similar, should be generalised for all commands, PT? --djk
if (_SBGetCurrentView().selection.count != 0)
gMM.sequencer.playView(_SBGetCurrentView(),
_SBGetCurrentView().getIndexForItem(_SBGetCurrentView().selection.currentMediaItem));
if (this._currentView.selection.count != 0)
gMM.sequencer.playView(this._currentView,
this._currentView.getIndexForItem(this._currentView.selection.currentMediaItem));
else
gMM.sequencer.playView(SBGetBrowser().currentMediaListView, 0);
@@ -240,9 +241,7 @@ const Player = Module("player", {
* @param {string} str The search string.
*/
searchView: function searchView(str) {
let currentView = _SBGetCurrentView();
let mediaItemList = currentView.mediaList;
let search = _getSearchString(currentView);
let search = _getSearchString(this._currentView);
let searchString = "";
if (search != "") // XXX
@@ -252,12 +251,12 @@ const Player = Module("player", {
this._lastSearchString = searchString;
let mySearchView = LibraryUtils.createStandardMediaListView(mediaItemList, searchString);
let searchView = LibraryUtils.createStandardMediaListView(this._currentView.mediaList, searchString);
if (mySearchView.length) {
this._lastSearchView = mySearchView;
if (searchView.length) {
this._lastSearchView = searchView;
this._lastSearchIndex = 0;
this.focusTrack(mySearchView.getItemByIndex(this._lastSearchIndex));
this.focusTrack(searchView.getItemByIndex(this._lastSearchIndex));
}
else
liberator.echoerr("E486 Pattern not found: " + searchString, commandline.FORCE_SINGLELINE);
@@ -266,7 +265,8 @@ const Player = Module("player", {
/**
* Repeats the previous view search.
*
* @param {boolean} reverse
* @param {boolean} reverse Search in the reverse direction to the previous
* search.
*/
searchViewAgain: function searchViewAgain(reverse) {
function echo(str) {
@@ -292,7 +292,7 @@ const Player = Module("player", {
this._lastSearchIndex = this._lastSearchIndex + 1;
}
// FIXME: Implement for "?" --ken
// TODO: Implement for "?" --ken
commandline.echo("/" + this._lastSearchString, null, commandline.FORCE_SINGLELINE);
this.focusTrack(this._lastSearchView.getItemByIndex(this._lastSearchIndex));
@@ -431,7 +431,7 @@ const Player = Module("player", {
break;
}
_SBGetCurrentView().setSort(properties);
this._currentView.setSort(properties);
}
}, {
}, {
@@ -474,7 +474,7 @@ const Player = Module("player", {
for ([i, list] in Iterator(playlists)) {
if (util.compareIgnoreCase(arg, list.name) == 0) {
SBGetBrowser().loadMediaList(playlists[i]);
this.focusTrack(_SBGetCurrentView().getItemByIndex(0));
this.focusTrack(this._currentView.getItemByIndex(0));
return;
}
}
@@ -761,7 +761,7 @@ const Player = Module("player", {
mappings.add([modes.PLAYER],
["<C-" + rating + ">"], "Rate the current media item " + rating,
function () {
let item = gMM.sequencer.currentItem || _SBGetCurrentView().selection.currentMediaItem; // XXX: a bit too magic
let item = gMM.sequencer.currentItem || this._currentView.selection.currentMediaItem; // XXX: a bit too magic
if (item)
player.rateMediaItem(item, rating);
else