diff options
author | Kris Maglione <maglione.k@gmail.com> | 2011-08-11 03:44:22 -0400 |
---|---|---|
committer | Kris Maglione <maglione.k@gmail.com> | 2011-08-11 03:44:22 -0400 |
commit | d877fa5fea9c7cebd663375d1e868307dafc0364 (patch) | |
tree | 4d8671de753b19d4dae9db36fa64c5d7560f3a4c | |
parent | a5c442150b800a6bb9a05667f568907080312105 (diff) | |
download | pentadactyl-d877fa5fea9c7cebd663375d1e868307dafc0364.tar.gz |
Push location stack on //?/n/N/[/].
-rw-r--r-- | common/content/autocommands.js | 30 | ||||
-rw-r--r-- | common/content/buffer.js | 2 | ||||
-rw-r--r-- | common/content/marks.js | 6 | ||||
-rw-r--r-- | common/modules/finder.jsm | 3 |
4 files changed, 27 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 }; diff --git a/common/modules/finder.jsm b/common/modules/finder.jsm index 97930350..6ff2caee 100644 --- a/common/modules/finder.jsm +++ b/common/modules/finder.jsm @@ -45,6 +45,7 @@ var RangeFinder = Module("rangefinder", { get options() this.modules.options, openPrompt: function (mode) { + this.modules.marks.push(); this.commandline; this.CommandMode(mode).open(); @@ -103,6 +104,7 @@ var RangeFinder = Module("rangefinder", { }, find: function (pattern, backwards) { + this.modules.marks.push(); let str = this.bootstrap(pattern, backwards); if (!this.rangeFind.find(str)) this.dactyl.echoerr(_("finder.notFound", pattern), @@ -112,6 +114,7 @@ var RangeFinder = Module("rangefinder", { }, findAgain: function (reverse) { + this.modules.marks.push(); if (!this.rangeFind) this.find(this.lastFindPattern); else if (!this.rangeFind.find(null, reverse)) |