mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 00:37:58 +01:00
Add C_<C-t>.
This commit is contained in:
@@ -172,8 +172,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
NEW_BACKGROUND_TAB: "background-tab",
|
NEW_BACKGROUND_TAB: "background-tab",
|
||||||
NEW_WINDOW: "window",
|
NEW_WINDOW: "window",
|
||||||
|
|
||||||
forceNewTab: false,
|
forceTarget: null,
|
||||||
forceNewWindow: false,
|
|
||||||
|
|
||||||
version: deprecated("config.version", { get: function version() config.version }),
|
version: deprecated("config.version", { get: function version() config.version }),
|
||||||
|
|
||||||
@@ -215,7 +214,6 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
this._observers[type] = this._observers[type].filter(function (c) c.get() != callback);
|
this._observers[type] = this._observers[type].filter(function (c) c.get() != callback);
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO: "zoom": if the zoom value of the current buffer changed
|
|
||||||
applyTriggerObserver: function triggerObserver(type, args) {
|
applyTriggerObserver: function triggerObserver(type, args) {
|
||||||
if (type in this._observers)
|
if (type in this._observers)
|
||||||
this._observers[type] = this._observers[type].filter(function (callback) {
|
this._observers[type] = this._observers[type].filter(function (callback) {
|
||||||
@@ -1237,8 +1235,9 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
if (dactyl.commands[command])
|
if (dactyl.commands[command])
|
||||||
dactyl.withSavedValues(["forceNewTab"], function () {
|
dactyl.withSavedValues(["forceTarget"], function () {
|
||||||
dactyl.forceNewTab = event.ctrlKey || event.shiftKey || event.button == 1;
|
if (event.ctrlKey || event.shiftKey || event.button == 1)
|
||||||
|
dactyl.forceTarget = dactyl.NEW_TAB;
|
||||||
dactyl.commands[command](event);
|
dactyl.commands[command](event);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1348,10 +1347,8 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
// any genuine errors go unreported.
|
// any genuine errors go unreported.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dactyl.forceNewTab)
|
if (dactyl.forceTarget)
|
||||||
where = dactyl.NEW_TAB;
|
where = dactyl.forceTarget;
|
||||||
else if (dactyl.forceNewWindow)
|
|
||||||
where = dactyl.NEW_WINDOW;
|
|
||||||
else if (!where)
|
else if (!where)
|
||||||
where = dactyl.CURRENT_TAB;
|
where = dactyl.CURRENT_TAB;
|
||||||
|
|
||||||
@@ -1553,7 +1550,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
|
|
||||||
wrapCallback: function (callback, self) {
|
wrapCallback: function (callback, self) {
|
||||||
self = self || this;
|
self = self || this;
|
||||||
let save = ["forceNewTab", "forceNewWindow"];
|
let save = ["forceTarget"];
|
||||||
let saved = save.map(function (p) dactyl[p]);
|
let saved = save.map(function (p) dactyl[p]);
|
||||||
return function wrappedCallback() {
|
return function wrappedCallback() {
|
||||||
let args = arguments;
|
let args = arguments;
|
||||||
@@ -2176,8 +2173,8 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
if (localPrefs.get("first-run", true))
|
if (localPrefs.get("first-run", true))
|
||||||
dactyl.timeout(function () {
|
dactyl.timeout(function () {
|
||||||
localPrefs.set("first-run", false);
|
localPrefs.set("first-run", false);
|
||||||
this.withSavedValues(["forceNewTab"], function () {
|
this.withSavedValues(["forceTarget"], function () {
|
||||||
this.forceNewTab = true;
|
this.forceTarget = dactyl.NEW_TAB;
|
||||||
this.help();
|
this.help();
|
||||||
});
|
});
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|||||||
@@ -128,9 +128,10 @@ var Map = Class("Map", {
|
|||||||
if (this.names[0] != ".") // FIXME: Kludge.
|
if (this.names[0] != ".") // FIXME: Kludge.
|
||||||
mappings.repeat = repeat;
|
mappings.repeat = repeat;
|
||||||
|
|
||||||
if (this.executing)
|
if (this.executing) {
|
||||||
util.dumpStack(_("map.recursive", args.command));
|
util.dumpStack(_("map.recursive", args.command));
|
||||||
dactyl.assert(!this.executing, _("map.recursive", args.command));
|
throw AssertionError(_("map.recursive", args.command));
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.preExecute(args);
|
this.preExecute(args);
|
||||||
@@ -144,6 +145,7 @@ var Map = Class("Map", {
|
|||||||
finally {
|
finally {
|
||||||
this.executing = false;
|
this.executing = false;
|
||||||
this.postExecute(args);
|
this.postExecute(args);
|
||||||
|
dactyl.triggerObserver("mappings.executed", this, args);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,9 +54,16 @@ var Tabs = Module("tabs", {
|
|||||||
enter: function enter() {
|
enter: function enter() {
|
||||||
if (window.TabsInTitlebar)
|
if (window.TabsInTitlebar)
|
||||||
window.TabsInTitlebar.allowedBy("dactyl", true);
|
window.TabsInTitlebar.allowedBy("dactyl", true);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"mappings.executed": function mappings_executed() {
|
||||||
|
if (this._mappingCount && !--this._mappingCount)
|
||||||
|
dactyl.forceTarget = this._originalTarget;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
_mappingCount: 0,
|
||||||
|
|
||||||
_alternates: Class.memoize(function () [config.tabbrowser.mCurrentTab, null]),
|
_alternates: Class.memoize(function () [config.tabbrowser.mCurrentTab, null]),
|
||||||
|
|
||||||
cleanup: function cleanup() {
|
cleanup: function cleanup() {
|
||||||
@@ -645,8 +652,8 @@ var Tabs = Module("tabs", {
|
|||||||
commands.add(["tab"],
|
commands.add(["tab"],
|
||||||
"Execute a command and tell it to output in a new tab",
|
"Execute a command and tell it to output in a new tab",
|
||||||
function (args) {
|
function (args) {
|
||||||
dactyl.withSavedValues(["forceNewTab"], function () {
|
dactyl.withSavedValues(["forceTarget"], function () {
|
||||||
this.forceNewTab = true;
|
this.forceTarget = dactyl.NEW_TAB;
|
||||||
dactyl.execute(args[0], null, true);
|
dactyl.execute(args[0], null, true);
|
||||||
});
|
});
|
||||||
}, {
|
}, {
|
||||||
@@ -948,6 +955,16 @@ var Tabs = Module("tabs", {
|
|||||||
events.listen(tabContainer, "TabSelect", tabs.closure._onTabSelect, false);
|
events.listen(tabContainer, "TabSelect", tabs.closure._onTabSelect, false);
|
||||||
},
|
},
|
||||||
mappings: function () {
|
mappings: function () {
|
||||||
|
|
||||||
|
mappings.add([modes.COMMAND], ["<C-t>", "<new-tab-next>"],
|
||||||
|
"Execute the next mapping in a new tab",
|
||||||
|
function ({ count }) {
|
||||||
|
tabs._mappingCount += (count || 1) + 1;
|
||||||
|
tabs._originalTarget = dactyl.forceTarget;
|
||||||
|
dactyl.forceTarget = dactyl.NEW_TAB;
|
||||||
|
},
|
||||||
|
{ count: true });
|
||||||
|
|
||||||
mappings.add([modes.NORMAL], ["g0", "g^"],
|
mappings.add([modes.NORMAL], ["g0", "g^"],
|
||||||
"Go to the first tab",
|
"Go to the first tab",
|
||||||
function () { tabs.select(0); });
|
function () { tabs.select(0); });
|
||||||
|
|||||||
@@ -58,6 +58,15 @@
|
|||||||
|
|
||||||
<h2 tag="opening-tabs">Opening tabs</h2>
|
<h2 tag="opening-tabs">Opening tabs</h2>
|
||||||
|
|
||||||
|
<item>
|
||||||
|
<tags><![CDATA[<new-tab-next> <C-t>]]></tags>
|
||||||
|
<spec><oa>count</oa><![CDATA[<C-t>]]></spec>
|
||||||
|
<description>
|
||||||
|
<p>Execute the next <oa>count</oa> mappings in a new tab.</p>
|
||||||
|
</description>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
|
||||||
<item>
|
<item>
|
||||||
<tags>:tab</tags>
|
<tags>:tab</tags>
|
||||||
<strut/>
|
<strut/>
|
||||||
|
|||||||
@@ -86,6 +86,7 @@
|
|||||||
- Added 'timeout' and 'timeoutlen' options. [b6]
|
- Added 'timeout' and 'timeoutlen' options. [b6]
|
||||||
- Added n_{, n_}, n_[ and n_] mappings. [b7]
|
- Added n_{, n_}, n_[ and n_] mappings. [b7]
|
||||||
- Added n_g], n_[d and n_]d. [b8]
|
- Added n_g], n_[d and n_]d. [b8]
|
||||||
|
- Added <C-t> to open the next mapping in a new tab. [b8]
|
||||||
- Added <A-b> to execute a builtin mapping. [b6]
|
- Added <A-b> to execute a builtin mapping. [b6]
|
||||||
- Added <A-m>l and <A-m>s to aid in the construction of
|
- Added <A-m>l and <A-m>s to aid in the construction of
|
||||||
macros. [b6]
|
macros. [b6]
|
||||||
|
|||||||
@@ -242,8 +242,8 @@ var Config = Module("config", ConfigBase, {
|
|||||||
commands.add(["wind[ow]"],
|
commands.add(["wind[ow]"],
|
||||||
"Execute a command and tell it to output in a new window",
|
"Execute a command and tell it to output in a new window",
|
||||||
function (args) {
|
function (args) {
|
||||||
dactyl.withSavedValues(["forceNewWindow"], function () {
|
dactyl.withSavedValues(["forceTarget"], function () {
|
||||||
this.forceNewWindow = true;
|
this.forceTarget = dactyl.NEW_WINDOW;
|
||||||
this.execute(args[0], null, true);
|
this.execute(args[0], null, true);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user