mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-04-24 23:11:25 +02:00
Fix stupid idiosyncratic idiosyncrasy: RegExp literals are not like array literals—they always return the same object. Remove some dead code.
This commit is contained in:
@@ -819,7 +819,7 @@ function Events() //{{{
|
|||||||
|
|
||||||
buffer.loaded = 1; // even if not a full page load, assume it did load correctly before starting the macro
|
buffer.loaded = 1; // even if not a full page load, assume it did load correctly before starting the macro
|
||||||
modes.isReplaying = true;
|
modes.isReplaying = true;
|
||||||
res = events.feedkeys(macros.get(lastMacro), true); // true -> noremap
|
res = events.feedkeys(macros.get(lastMacro), { noremap: true });
|
||||||
modes.isReplaying = false;
|
modes.isReplaying = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -866,7 +866,7 @@ function Events() //{{{
|
|||||||
},
|
},
|
||||||
|
|
||||||
splitKeys: function(keys) {
|
splitKeys: function(keys) {
|
||||||
let re = /<.*?>|[^<]/g
|
let re = RegExp("<.*?>|[^<]", "g");
|
||||||
let match;
|
let match;
|
||||||
while (match = re.exec(keys))
|
while (match = re.exec(keys))
|
||||||
yield match[0];
|
yield match[0];
|
||||||
@@ -920,7 +920,6 @@ function Events() //{{{
|
|||||||
{
|
{
|
||||||
let doc = window.document;
|
let doc = window.document;
|
||||||
let view = window.document.defaultView;
|
let view = window.document.defaultView;
|
||||||
let escapeKey = false; // \ to escape some special keys
|
|
||||||
|
|
||||||
let wasFeeding = this.feedingKeys;
|
let wasFeeding = this.feedingKeys;
|
||||||
this.feedingKeys = true;
|
this.feedingKeys = true;
|
||||||
@@ -937,7 +936,7 @@ function Events() //{{{
|
|||||||
{
|
{
|
||||||
let charCode = key.charCodeAt(0);
|
let charCode = key.charCodeAt(0);
|
||||||
let keyCode = 0;
|
let keyCode = 0;
|
||||||
let shift = false, ctrl = false, alt = false, meta = false;
|
let [shift, ctrl, alt, meta] = [false, false, false, false]
|
||||||
let string = null;
|
let string = null;
|
||||||
|
|
||||||
if (key[0] == "<")
|
if (key[0] == "<")
|
||||||
@@ -972,8 +971,6 @@ function Events() //{{{
|
|||||||
|
|
||||||
if (keyCode == 32)
|
if (keyCode == 32)
|
||||||
charCode = 32;
|
charCode = 32;
|
||||||
|
|
||||||
i += match.length - 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // a simple key
|
else // a simple key
|
||||||
@@ -1021,10 +1018,9 @@ function Events() //{{{
|
|||||||
{
|
{
|
||||||
let duringFeed = this.duringFeed;
|
let duringFeed = this.duringFeed;
|
||||||
this.duringFeed = "";
|
this.duringFeed = "";
|
||||||
setTimeout(function () events.feedkeys(duringFeed, false, false, true), 0);
|
setTimeout(function () events.feedkeys(duringFeed), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return i == keys.length;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1211,9 +1207,6 @@ function Events() //{{{
|
|||||||
// argument "event" is deliberately not used, as i don't seem to have
|
// argument "event" is deliberately not used, as i don't seem to have
|
||||||
// access to the real focus target
|
// access to the real focus target
|
||||||
// Huh? --djk
|
// Huh? --djk
|
||||||
//
|
|
||||||
// the ugly wantsModeReset is needed, because Firefox generates a massive
|
|
||||||
// amount of focus changes for things like <C-v><C-k> (focusing the search field)
|
|
||||||
onFocusChange: function (event)
|
onFocusChange: function (event)
|
||||||
{
|
{
|
||||||
// command line has it's own focus change handler
|
// command line has it's own focus change handler
|
||||||
@@ -1236,7 +1229,6 @@ function Events() //{{{
|
|||||||
if ((elem instanceof HTMLInputElement && /^(text|password)$/.test(elem.type)) ||
|
if ((elem instanceof HTMLInputElement && /^(text|password)$/.test(elem.type)) ||
|
||||||
(elem instanceof HTMLSelectElement))
|
(elem instanceof HTMLSelectElement))
|
||||||
{
|
{
|
||||||
this.wantsModeReset = false;
|
|
||||||
liberator.mode = modes.INSERT;
|
liberator.mode = modes.INSERT;
|
||||||
if (hasHTMLDocument(win))
|
if (hasHTMLDocument(win))
|
||||||
buffer.lastInputField = elem;
|
buffer.lastInputField = elem;
|
||||||
@@ -1245,7 +1237,6 @@ function Events() //{{{
|
|||||||
|
|
||||||
if (elem instanceof HTMLTextAreaElement || (elem && elem.contentEditable == "true"))
|
if (elem instanceof HTMLTextAreaElement || (elem && elem.contentEditable == "true"))
|
||||||
{
|
{
|
||||||
this.wantsModeReset = false;
|
|
||||||
if (options["insertmode"])
|
if (options["insertmode"])
|
||||||
modes.set(modes.INSERT, modes.TEXTAREA);
|
modes.set(modes.INSERT, modes.TEXTAREA);
|
||||||
else if (elem.selectionEnd - elem.selectionStart > 0)
|
else if (elem.selectionEnd - elem.selectionStart > 0)
|
||||||
@@ -1265,21 +1256,7 @@ function Events() //{{{
|
|||||||
liberator.threadYield(true);
|
liberator.threadYield(true);
|
||||||
|
|
||||||
if (liberator.mode & (modes.INSERT | modes.TEXTAREA | modes.MESSAGE | modes.VISUAL))
|
if (liberator.mode & (modes.INSERT | modes.TEXTAREA | modes.MESSAGE | modes.VISUAL))
|
||||||
{
|
modes.reset();
|
||||||
if (0) // FIXME: currently this hack is disabled to make macros work
|
|
||||||
{
|
|
||||||
this.wantsModeReset = true;
|
|
||||||
setTimeout(function () {
|
|
||||||
if (events.wantsModeReset)
|
|
||||||
{
|
|
||||||
events.wantsModeReset = false;
|
|
||||||
modes.reset();
|
|
||||||
}
|
|
||||||
}, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
modes.reset();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@@ -1618,7 +1595,6 @@ function Events() //{{{
|
|||||||
let motionMap = (input.pendingMotionMap && input.pendingMotionMap.names[0]) || "";
|
let motionMap = (input.pendingMotionMap && input.pendingMotionMap.names[0]) || "";
|
||||||
statusline.updateInputBuffer(motionMap + input.buffer);
|
statusline.updateInputBuffer(motionMap + input.buffer);
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// this is need for sites like msn.com which focus the input field on keydown
|
// this is need for sites like msn.com which focus the input field on keydown
|
||||||
|
|||||||
Reference in New Issue
Block a user