mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 05:17: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 } \
|
||||
!profile && /\nName=default\n/ { args["name=default"] = $$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 } \
|
||||
END {\
|
||||
END { \
|
||||
if (args["IsRelative"]) print ENVIRON["dir"] "/" args["Path"]; \
|
||||
else print args["Path"] \
|
||||
}'); \
|
||||
|
||||
@@ -85,7 +85,7 @@ const Buffer = Module("buffer", {
|
||||
|
||||
// get file size
|
||||
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"])) {
|
||||
try {
|
||||
@@ -249,13 +249,13 @@ const Buffer = Module("buffer", {
|
||||
onSecurityChange.superapply(this, arguments);
|
||||
// TODO: do something useful with STATE_SECURE_MED and STATE_SECURE_LOW
|
||||
if (state & Ci.nsIWebProgressListener.STATE_IS_INSECURE)
|
||||
statusline.setClass("insecure");
|
||||
statusline.class = "insecure";
|
||||
else if (state & Ci.nsIWebProgressListener.STATE_IS_BROKEN)
|
||||
statusline.setClass("broken");
|
||||
statusline.class = "broken";
|
||||
else if (state & Ci.nsIWebProgressListener.STATE_IDENTITY_EV_TOPLEVEL)
|
||||
statusline.setClass("extended");
|
||||
statusline.class = "extended";
|
||||
else if (state & Ci.nsIWebProgressListener.STATE_SECURE_HIGH)
|
||||
statusline.setClass("secure");
|
||||
statusline.class = "secure";
|
||||
},
|
||||
onStatusChange: function onStatusChange(webProgress, request, status, message) {
|
||||
onStatusChange.superapply(this, arguments);
|
||||
@@ -1108,8 +1108,10 @@ const Buffer = Module("buffer", {
|
||||
return elem;
|
||||
}
|
||||
|
||||
if (buffer.focusedFrame.getSelection().rangeCount)
|
||||
var elem = find(buffer.focusedFrame.getSelection().getRangeAt(0).startContainer);
|
||||
let sel = buffer.focusedFrame.getSelection();
|
||||
if (sel && sel.rangeCount)
|
||||
var elem = find(sel.getRangeAt(0).startContainer);
|
||||
|
||||
if (!(elem instanceof Element)) {
|
||||
let doc = Buffer.findScrollableWindow().document;
|
||||
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) ||
|
||||
elem instanceof HTMLSelectElement ||
|
||||
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))
|
||||
buffer.lastInputField = elem;
|
||||
return;
|
||||
@@ -735,10 +737,11 @@ const Events = Module("events", {
|
||||
if (modes.main === modes.VISUAL && elem.selectionEnd == elem.selectionStart)
|
||||
modes.pop();
|
||||
|
||||
if (!(modes.main & (modes.INSERT | modes.TEXT_EDIT | modes.VISUAL)))
|
||||
if (options["insertmode"])
|
||||
modes.set(modes.INSERT);
|
||||
modes.push(modes.INSERT);
|
||||
else {
|
||||
modes.set(modes.TEXT_EDIT);
|
||||
modes.push(modes.TEXT_EDIT);
|
||||
if (elem.selectionEnd - elem.selectionStart > 0)
|
||||
modes.push(modes.VISUAL);
|
||||
}
|
||||
|
||||
@@ -172,6 +172,12 @@ const Modes = Module("modes", {
|
||||
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],
|
||||
|
||||
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
|
||||
*/
|
||||
setClass: function setClass(type) {
|
||||
set class(type) {
|
||||
this._class = type;
|
||||
const highlightGroup = {
|
||||
extended: "StatusLineExtended",
|
||||
secure: "StatusLineSecure",
|
||||
@@ -54,6 +55,7 @@ const StatusLine = Module("statusline", {
|
||||
|
||||
highlight.highlightNode(this._statusLine, highlightGroup[type]);
|
||||
},
|
||||
get class() this._class,
|
||||
|
||||
// update all fields of the statusline
|
||||
update: function update() {
|
||||
|
||||
Reference in New Issue
Block a user