summaryrefslogtreecommitdiff
path: root/common/content
diff options
context:
space:
mode:
authorKris Maglione <maglione.k@gmail.com>2011-08-11 03:44:22 -0400
committerKris Maglione <maglione.k@gmail.com>2011-08-11 03:44:22 -0400
commitd877fa5fea9c7cebd663375d1e868307dafc0364 (patch)
tree4d8671de753b19d4dae9db36fa64c5d7560f3a4c /common/content
parenta5c442150b800a6bb9a05667f568907080312105 (diff)
downloadpentadactyl-d877fa5fea9c7cebd663375d1e868307dafc0364.tar.gz
Push location stack on //?/n/N/[/].
Diffstat (limited to 'common/content')
-rw-r--r--common/content/autocommands.js30
-rw-r--r--common/content/buffer.js2
-rw-r--r--common/content/marks.js6
3 files changed, 24 insertions, 14 deletions
diff --git a/common/content/autocommands.js b/common/content/autocommands.js
index a114ced8..4c50fb21 100644
--- a/common/content/autocommands.js
+++ b/common/content/autocommands.js
@@ -13,7 +13,7 @@ update(AutoCommand.prototype, {
eventName: Class.memoize(function () this.event.toLowerCase()),
match: function (event, pattern) {
- return (!event || this.eventName == event.toLowerCase()) && (!pattern || String(this.filter) === pattern);
+ return (!event || this.eventName == event.toLowerCase()) && (!pattern || String(this.filter) === String(pattern));
}
});
@@ -43,24 +43,26 @@ var AutoCmdHive = Class("AutoCmdHive", Contexts.Hive, {
},
/**
- * Returns all autocommands with a matching *event* and *regexp*.
+ * Returns all autocommands with a matching *event* and *filter*.
*
* @param {string} event The event name filter.
- * @param {string} pattern The URL pattern filter.
+ * @param {string} filter The URL pattern filter.
* @returns {[AutoCommand]}
*/
- get: function (event, pattern) {
- return this._store.filter(function (autoCmd) autoCmd.match(event, regexp));
+ get: function (event, filter) {
+ filter = filter && String(Group.compileFilter(filter));
+ return this._store.filter(function (autoCmd) autoCmd.match(event, filter));
},
/**
- * Deletes all autocommands with a matching *event* and *regexp*.
+ * Deletes all autocommands with a matching *event* and *filter*.
*
* @param {string} event The event name filter.
- * @param {string} regexp The URL pattern filter.
+ * @param {string} filter The URL pattern filter.
*/
- remove: function (event, regexp) {
- this._store = this._store.filter(function (autoCmd) !autoCmd.match(event, regexp));
+ remove: function (event, filter) {
+ filter = filter && String(Group.compileFilter(filter));
+ this._store = this._store.filter(function (autoCmd) !autoCmd.match(event, filter));
},
});
@@ -178,7 +180,7 @@ var AutoCommands = Module("autocommands", {
commands.add(["au[tocmd]"],
"Execute commands automatically on events",
function (args) {
- let [event, regexp, cmd] = args;
+ let [event, filter, cmd] = args;
let events = [];
if (event) {
@@ -193,9 +195,9 @@ var AutoCommands = Module("autocommands", {
if (args.length > 2) { // add new command, possibly removing all others with the same event/pattern
if (args.bang)
- args["-group"].remove(event, regexp);
+ args["-group"].remove(event, filter);
cmd = contexts.bindMacro(args, "-ex", function (params) params);
- args["-group"].add(events, regexp, cmd);
+ args["-group"].add(events, filter, cmd);
}
else {
if (event == "*")
@@ -204,10 +206,10 @@ var AutoCommands = Module("autocommands", {
if (args.bang) {
// TODO: "*" only appears to work in Vim when there is a {group} specified
if (args[0] != "*" || args.length > 1)
- args["-group"].remove(event, regexp); // remove all
+ args["-group"].remove(event, filter); // remove all
}
else
- autocommands.list(event, regexp, args.explicitOpts["-group"] ? [args["-group"]] : null); // list all
+ autocommands.list(event, filter, args.explicitOpts["-group"] ? [args["-group"]] : null); // list all
}
}, {
bang: true,
diff --git a/common/content/buffer.js b/common/content/buffer.js
index ba84392e..b347eeaf 100644
--- a/common/content/buffer.js
+++ b/common/content/buffer.js
@@ -832,6 +832,8 @@ var Buffer = Module("buffer", {
findJump: function findJump(arg, count, reverse, offScreen) {
const FUDGE = 10;
+ marks.push();
+
let path = options["jumptags"][arg];
dactyl.assert(path, _("error.invalidArgument", arg));
diff --git a/common/content/marks.js b/common/content/marks.js
index 99d42b8c..e6bbb9b4 100644
--- a/common/content/marks.js
+++ b/common/content/marks.js
@@ -44,6 +44,10 @@ var Marks = Module("marks", {
params.offset = buffer.scrollPosition;
params.path = util.generateXPath(buffer.findScrollable(0, params.offset.x));
params.timestamp = Date.now() * 1000;
+ params.equals = function (m) this.location == m.location
+ && this.offset.x == m.offset.x
+ && this.offset.y == m.offset.y
+ && this.path == m.path;
return params;
},
@@ -90,6 +94,8 @@ var Marks = Module("marks", {
return;
let mark = this.add("'");
+ if (jump && mark.equals(jump.mark))
+ return;
if (!this.jumping) {
store.jumps[++store.jumpsIndex] = { mark: mark, reason: reason };