mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 05:27:59 +01:00
Push INSERT mode on top of PASS THROUGH mode when entering an input field, rather than clearing the mode stack.
This commit is contained in:
@@ -115,9 +115,12 @@ install:
|
|||||||
index($$0, "\nName=" profile "\n") { print; exit } \
|
index($$0, "\nName=" profile "\n") { print; exit } \
|
||||||
!profile && /\nName=default\n/ { args["name=default"] = $$0 } \
|
!profile && /\nName=default\n/ { args["name=default"] = $$0 } \
|
||||||
!profile && /\nDefault=1/ { args["default=1"] = $$0 } \
|
!profile && /\nDefault=1/ { args["default=1"] = $$0 } \
|
||||||
END { if (args["default=1"]) print args["default=1"]; else print args["name=default"] }' |\
|
END { \
|
||||||
|
if (args["default=1"]) print args["default=1"]; \
|
||||||
|
else print args["name=default"] \
|
||||||
|
}' | \
|
||||||
awk -F= '{ args[$$1] = $$2 } \
|
awk -F= '{ args[$$1] = $$2 } \
|
||||||
END {\
|
END { \
|
||||||
if (args["IsRelative"]) print ENVIRON["dir"] "/" args["Path"]; \
|
if (args["IsRelative"]) print ENVIRON["dir"] "/" args["Path"]; \
|
||||||
else print args["Path"] \
|
else print args["Path"] \
|
||||||
}'); \
|
}'); \
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ const Buffer = Module("buffer", {
|
|||||||
|
|
||||||
// get file size
|
// get file size
|
||||||
const ACCESS_READ = Ci.nsICache.ACCESS_READ;
|
const ACCESS_READ = Ci.nsICache.ACCESS_READ;
|
||||||
let cacheKey = doc.location.toString().replace(/#.*$/, "");
|
let cacheKey = doc.documentURI;
|
||||||
|
|
||||||
for (let proto in array.iterValues(["HTTP", "FTP"])) {
|
for (let proto in array.iterValues(["HTTP", "FTP"])) {
|
||||||
try {
|
try {
|
||||||
@@ -249,13 +249,13 @@ const Buffer = Module("buffer", {
|
|||||||
onSecurityChange.superapply(this, arguments);
|
onSecurityChange.superapply(this, arguments);
|
||||||
// TODO: do something useful with STATE_SECURE_MED and STATE_SECURE_LOW
|
// TODO: do something useful with STATE_SECURE_MED and STATE_SECURE_LOW
|
||||||
if (state & Ci.nsIWebProgressListener.STATE_IS_INSECURE)
|
if (state & Ci.nsIWebProgressListener.STATE_IS_INSECURE)
|
||||||
statusline.setClass("insecure");
|
statusline.class = "insecure";
|
||||||
else if (state & Ci.nsIWebProgressListener.STATE_IS_BROKEN)
|
else if (state & Ci.nsIWebProgressListener.STATE_IS_BROKEN)
|
||||||
statusline.setClass("broken");
|
statusline.class = "broken";
|
||||||
else if (state & Ci.nsIWebProgressListener.STATE_IDENTITY_EV_TOPLEVEL)
|
else if (state & Ci.nsIWebProgressListener.STATE_IDENTITY_EV_TOPLEVEL)
|
||||||
statusline.setClass("extended");
|
statusline.class = "extended";
|
||||||
else if (state & Ci.nsIWebProgressListener.STATE_SECURE_HIGH)
|
else if (state & Ci.nsIWebProgressListener.STATE_SECURE_HIGH)
|
||||||
statusline.setClass("secure");
|
statusline.class = "secure";
|
||||||
},
|
},
|
||||||
onStatusChange: function onStatusChange(webProgress, request, status, message) {
|
onStatusChange: function onStatusChange(webProgress, request, status, message) {
|
||||||
onStatusChange.superapply(this, arguments);
|
onStatusChange.superapply(this, arguments);
|
||||||
@@ -1108,8 +1108,10 @@ const Buffer = Module("buffer", {
|
|||||||
return elem;
|
return elem;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buffer.focusedFrame.getSelection().rangeCount)
|
let sel = buffer.focusedFrame.getSelection();
|
||||||
var elem = find(buffer.focusedFrame.getSelection().getRangeAt(0).startContainer);
|
if (sel && sel.rangeCount)
|
||||||
|
var elem = find(sel.getRangeAt(0).startContainer);
|
||||||
|
|
||||||
if (!(elem instanceof Element)) {
|
if (!(elem instanceof Element)) {
|
||||||
let doc = Buffer.findScrollableWindow().document;
|
let doc = Buffer.findScrollableWindow().document;
|
||||||
elem = find(doc.body || doc.getElementsByTagName("body")[0] ||
|
elem = find(doc.body || doc.getElementsByTagName("body")[0] ||
|
||||||
|
|||||||
@@ -718,7 +718,9 @@ const Events = Module("events", {
|
|||||||
if (elem instanceof HTMLInputElement && set.has(util.editableInputs, elem.type) ||
|
if (elem instanceof HTMLInputElement && set.has(util.editableInputs, elem.type) ||
|
||||||
elem instanceof HTMLSelectElement ||
|
elem instanceof HTMLSelectElement ||
|
||||||
elem instanceof Window && Editor.getEditor(elem)) {
|
elem instanceof Window && Editor.getEditor(elem)) {
|
||||||
dactyl.mode = modes.INSERT;
|
if (!(modes.main & (modes.INSERT | modes.TEXT_EDIT | modes.VISUAL)))
|
||||||
|
modes.push(modes.INSERT);
|
||||||
|
|
||||||
if (hasHTMLDocument(win))
|
if (hasHTMLDocument(win))
|
||||||
buffer.lastInputField = elem;
|
buffer.lastInputField = elem;
|
||||||
return;
|
return;
|
||||||
@@ -735,13 +737,14 @@ const Events = Module("events", {
|
|||||||
if (modes.main === modes.VISUAL && elem.selectionEnd == elem.selectionStart)
|
if (modes.main === modes.VISUAL && elem.selectionEnd == elem.selectionStart)
|
||||||
modes.pop();
|
modes.pop();
|
||||||
|
|
||||||
if (options["insertmode"])
|
if (!(modes.main & (modes.INSERT | modes.TEXT_EDIT | modes.VISUAL)))
|
||||||
modes.set(modes.INSERT);
|
if (options["insertmode"])
|
||||||
else {
|
modes.push(modes.INSERT);
|
||||||
modes.set(modes.TEXT_EDIT);
|
else {
|
||||||
if (elem.selectionEnd - elem.selectionStart > 0)
|
modes.push(modes.TEXT_EDIT);
|
||||||
modes.push(modes.VISUAL);
|
if (elem.selectionEnd - elem.selectionStart > 0)
|
||||||
}
|
modes.push(modes.VISUAL);
|
||||||
|
}
|
||||||
|
|
||||||
if (hasHTMLDocument(win))
|
if (hasHTMLDocument(win))
|
||||||
buffer.lastInputField = elem;
|
buffer.lastInputField = elem;
|
||||||
|
|||||||
@@ -172,6 +172,12 @@ const Modes = Module("modes", {
|
|||||||
dactyl.triggerObserver("mode-add", mode);
|
dactyl.triggerObserver("mode-add", mode);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
dumpStack: function () {
|
||||||
|
util.dump("Mode stack:");
|
||||||
|
for (let [i, mode] in array.iterItems(this._modeStack))
|
||||||
|
util.dump(" " + i + ": " + mode);
|
||||||
|
},
|
||||||
|
|
||||||
getMode: function (name) this._modeMap[name],
|
getMode: function (name) this._modeMap[name],
|
||||||
|
|
||||||
getStack: function (idx) this._modeStack[this._modeStack.length - idx - 1] || this._modeStack[0],
|
getStack: function (idx) this._modeStack[this._modeStack.length - idx - 1] || this._modeStack[0],
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ const StatusLine = Module("statusline", {
|
|||||||
*
|
*
|
||||||
* @param {'extended'|'secure'|'broken'|'insecure'} type
|
* @param {'extended'|'secure'|'broken'|'insecure'} type
|
||||||
*/
|
*/
|
||||||
setClass: function setClass(type) {
|
set class(type) {
|
||||||
|
this._class = type;
|
||||||
const highlightGroup = {
|
const highlightGroup = {
|
||||||
extended: "StatusLineExtended",
|
extended: "StatusLineExtended",
|
||||||
secure: "StatusLineSecure",
|
secure: "StatusLineSecure",
|
||||||
@@ -54,6 +55,7 @@ const StatusLine = Module("statusline", {
|
|||||||
|
|
||||||
highlight.highlightNode(this._statusLine, highlightGroup[type]);
|
highlight.highlightNode(this._statusLine, highlightGroup[type]);
|
||||||
},
|
},
|
||||||
|
get class() this._class,
|
||||||
|
|
||||||
// update all fields of the statusline
|
// update all fields of the statusline
|
||||||
update: function update() {
|
update: function update() {
|
||||||
|
|||||||
Reference in New Issue
Block a user