1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-21 16:27:59 +01:00

Deprecate dactyl.mode.

This commit is contained in:
Kris Maglione
2010-12-30 18:03:03 -05:00
parent 2cb3135220
commit 69b9796249
4 changed files with 13 additions and 11 deletions

View File

@@ -253,7 +253,7 @@ var Buffer = Module("buffer", {
if (document.commandDispatcher.focusedWindow == webProgress.DOMWindow && this.dactylLoadCount++)
util.timeout(function () { modes.reset(false); },
dactyl.mode == modes.HINTS ? 500 : 0);
modes.main == modes.HINTS ? 500 : 0);
}
else if (flags & Ci.nsIWebProgressListener.STATE_STOP) {
// Workaround for bugs 591425 and 606877, dactyl bug #81

View File

@@ -91,8 +91,10 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
* @property {number} The current main mode.
* @see modes#mainModes
*/
get mode() modes.main,
set mode(value) modes.main = value,
mode: Class.Property({
get: deprecated("Please use modes.main instead", function mode() modes.main),
set: deprecated("Please use modes.main instead", function mode(val) modes.main = val),
}),
get menuItems() Dactyl.getMenuItems(),

View File

@@ -703,7 +703,7 @@ var Editor = Module("editor", {
function ({ arg, count }) {
let pos = editor.findCharForward(arg, Math.max(count, 1));
if (pos >= 0)
editor.moveToPosition(pos, true, dactyl.mode == modes.VISUAL);
editor.moveToPosition(pos, true, modes.main == modes.VISUAL);
},
{ arg: true, count: true });
@@ -712,7 +712,7 @@ var Editor = Module("editor", {
function ({ arg, count }) {
let pos = editor.findCharBackward(arg, Math.max(count, 1));
if (pos >= 0)
editor.moveToPosition(pos, false, dactyl.mode == modes.VISUAL);
editor.moveToPosition(pos, false, modes.main == modes.VISUAL);
},
{ arg: true, count: true });
@@ -721,7 +721,7 @@ var Editor = Module("editor", {
function ({ arg, count }) {
let pos = editor.findCharForward(arg, Math.max(count, 1));
if (pos >= 0)
editor.moveToPosition(pos - 1, true, dactyl.mode == modes.VISUAL);
editor.moveToPosition(pos - 1, true, modes.main == modes.VISUAL);
},
{ arg: true, count: true });
@@ -730,7 +730,7 @@ var Editor = Module("editor", {
function ({ arg, count }) {
let pos = editor.findCharBackward(arg, Math.max(count, 1));
if (pos >= 0)
editor.moveToPosition(pos + 1, false, dactyl.mode == modes.VISUAL);
editor.moveToPosition(pos + 1, false, modes.main == modes.VISUAL);
},
{ arg: true, count: true });

View File

@@ -693,7 +693,7 @@ var Events = Module("events", {
* The global escape key handler. This is called in ALL modes.
*/
onEscape: function () {
switch (dactyl.mode) {
switch (modes.main) {
case modes.COMMAND_LINE:
case modes.INSERT:
case modes.OUTPUT_MULTILINE:
@@ -784,7 +784,7 @@ var Events = Module("events", {
// Huh? --djk
onFocusChange: function onFocusChange(event) {
// command line has its own focus change handler
if (dactyl.mode == modes.COMMAND_LINE)
if (modes.main == modes.COMMAND_LINE)
return;
function hasHTMLDocument(win) win && win.document && win.document instanceof HTMLDocument
@@ -1015,14 +1015,14 @@ var Events = Module("events", {
let controller = document.commandDispatcher.getControllerForCommand("cmd_copy");
let couldCopy = controller && controller.isCommandEnabled("cmd_copy");
if (dactyl.mode == modes.VISUAL) {
if (modes.main == modes.VISUAL) {
if (!couldCopy)
modes.pop(); // Really not ideal.
}
else if (couldCopy) {
if (modes.main == modes.TEXT_EDIT && !options["insertmode"])
modes.push(modes.VISUAL);
else if (dactyl.mode == modes.CARET)
else if (modes.main == modes.CARET)
modes.push(modes.VISUAL);
}
}